Solved

Drawing on top of a listbox

Posted on 1997-02-22
1
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

688 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