Link to home
Start Free TrialLog in
Avatar of tdietz
tdietz

asked on

Drawing on top of a listbox

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
ASKER CERTIFIED SOLUTION
Avatar of YZ
YZ

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial