repaint clistctrl

Posted on 2006-04-25
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
    LVL 43

    Assisted Solution

    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

    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

    instead of issuing an Invalidate in the OnPaint, put this line:


    LVL 49

    Expert Comment

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    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.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    779 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

    15 Experts available now in Live!

    Get 1:1 Help Now