[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


repaint clistctrl

Posted on 2006-04-25
Medium Priority
Last Modified: 2013-11-20

Don't know how I could solve this one. I have a CListCtrl. It seems to have problems repainting itself sometimes. For instance, I can open a text file and postion notepad over the list control, kill notepad, and then the region notepad used to occupy will appear grey over my list control. It will not repaint that region until I minimize then maximize the application.

Is there anything I amy have overlooked that causes this? I have a list control right below it which does not exhibit this problem!

Question by:minnirok
  • 2
LVL 45

Assisted Solution

AndyAinscow earned 600 total points
ID: 16538414
Try a rebuild all.

Is the list control an owner/custom draw?

Are you doing anything in the OnPaint of the dialog?
LVL 49

Accepted Solution

DanRollins earned 800 total points
ID: 16540111
If the the two controls are in a dialog, then use the resource editor to examine any differences in the properties of the two items.  Just click the "pin" and then click back and forth between the controls and see what is different.  

My guess is that you have inadvertantly turned on one of the seldom-used settings under the "More Styles" or "Extended Styles" tab.
LVL 22

Assisted Solution

mahesh1402 earned 600 total points
ID: 16541391
instead of issuing an Invalidate in the OnPaint, put this line:


LVL 49

Expert Comment

ID: 16609164
Ah, I see.   This relates to your other question:
   CTabCtrl + CListCtrl causing problems

For the PAQ:
This was not an issue with the list control, per se, but with the order in which the controls were being repainted by the DialogBox handler.   The list ctrls were earlier in the internal child-window list (the tab order) than the TabCtrl on which they appear.  So the list control was drawn, then the TabCtrl was drawn -- and when the "invalidated" portion of its background was drawn, it obscured a portion of the list control.

The solution was to rearrange the order of the child windows so that the TabCtrl was redrawn earlier in the cycle than the ListCtrl.

-- Dan

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 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