We help IT Professionals succeed at work.

Resize/scroll flicker in ownerdraw CListCtrl

peterg062497
peterg062497 asked
on
Medium Priority
1,661 Views
Last Modified: 2013-11-19
I have an ownerdrawn list control which resizes and scrolls
just fine, but is there a way to reduce the noticeable flicker?
Comment
Watch Question

Engineer
Commented:
Have you tried looking at the SetRedraw method in CWnd? You can temporarily turn off redrawing, until the size if fully known and then redraw everything.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
SetRedraw makes the problem worse, as the listctrl blanks completely
from the first of many OnEraseBkgnd messages and won't repaint until
it's allowed from the SetRedraw(TRUE).
It appears that this is a common problem - I've seen it in the NT 4.0 file manager and explorer.  As a view is resized, erase messages keep coming in to stop the window from reflecting what is behind it, followed by OnPaint messages, which causes the flicker.  Trying to override the erase background message to erase only the rectangle(s) that have changed could get really hairy, unless someone else has done it and is willing to part with the code.
If I have mis-analyzed the problem please let me know.
Thanks
Pete Glick

Author

Commented:
I researched the problem myself, and found that the vertical and horizontal
redraw bits (CS_VREDRAW, CS_HREDRAW) needed to be removed from the View and Frame style masks.  This cured almost all the flicker.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.