Solved

Drawing on top of a listbox

Posted on 1997-02-22
1
428 Views
Last Modified: 2013-11-20
I have created a custom class derived from CListCtrl.  I want to have a standard entry field (CEdit) on top of one of the rows in the ListCtrl.  I will be hiding/showing it from time to time.  Sort of mimic'ing the cool in-place editing feature of the directory listbox for MSVC's options box.

I have been able to draw and show the edit field just fine, however if the CListCtrl needs to be repainted (let say a window covered it up for a second), the CEdit field gets painted first and then the CListCtrl paints over it.  All I see is a blinking caret when the window is done repainting.  It seems this is the order in which MFC paints the controls.  
Here is what I have tried:

1)  I have flagged the CListCtrl as transparent.  Funny thing, the on-line help says transparent windows will get called last, huh?  That doesn't make sense.

2)  OnPaint message for custom CListCtrl.  -- Doesn't work.  Everytime I update the window (i.e. draw something on top of it) it loops endlessly (like it wants to repaint it again and again because of my painting on top).

Is what I am doing possible?  I really don't want to draw the listbox and everything relating to it myself, I just want to paint something on top and use the listctrl as a normal listctrl.

Is this possible?

Tom
0
Comment
Question by:tdietz
1 Comment
 

Accepted Solution

by:
YZ earned 100 total points
ID: 1300286
First, CEdit object should be the child of CListrCtrl object.
Then, you should not send any invalidate messages to edit, it would be updated when it neccessary to windows. Forget about transparency - there is nothing common to the problem you got.
And the next, if your CEdit using some yours class subclassed from stabndard "EDIT" (RegisterWindowClass....), then check if your class does not have style CS_PARENTDC.
That should help.

BTW. I did the same thing with my own CListBox
derived class in Win3.X/95, and got no problems with this. Ask me if you want some sources.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now