repaint clistctrl


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!

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Try a rebuild all.

Is the list control an owner/custom draw?

Are you doing anything in the OnPaint of the dialog?
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mahesh1402IT ProfessionalCommented:
instead of issuing an Invalidate in the OnPaint, put this line:


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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.