Click here to Skip to main content
15,887,302 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

I'm writing a program that has custom graphic controls (just like task manager's graphs) which I coded myself. I'm usually running the program on WinXP and everything is fine.

I tested it on Win7 and I saw a nasty refresh problem. Virtually the controls are reduced to white rectangles while resizing. The rectangles are resized as it should but nothing but white can be seen inside them, and they stay like this after I finish resizing.

These controls are refreshed each second so after I finish resizing their content is shown within a second but without the sunken client edge which makes them look ugly. And Also none of the standard controls has this problem. only my custom ones.

I set these controls by placing a static text control in the dialog resource (with border property set) and then I set their control variable to be of my CWnd heired class that does the drawing at OnPaint (standard stuff I say this just for cleanness).

At first I figured it was because of pDC->ExcludeClipRect(&CtrlRect); I call at OnEraseBkgnd. It has wonderful anti-flicker effect in WinXP. So I made a build of my program having all that code in all OnEraseBkgnd funcs deleted (set as comments) so those function calls have their default behaviour.
- Absolutely no effect - it was just the same. So obviously that's not the problem.

I set a RedrawWindow call at OnSize which fixes the issue but that's very performance ineffective and the flicker is awful.

So does somebody encountered this problem? It'd be great if something can be done. I've googled this and all I found was that 2 years ago someone had very similar problem and he addressed it directly to MS support and they've said they'll look into it. :)

Thanks in advance! :)

P.S. If any additional info is needed please don't hesitate to ask me for it.
Posted
Updated 28-Dec-11 23:40pm
v3

The quick and dirty way would be to use LockWindowUpdate
http://msdn.microsoft.com/en-us/library/dd145034%28VS.85%29.aspx[^]

But, it would be better to use the WM_SETREDRAW to do this.

Recommended would be to cal BeginPaint and when done call EndPaint.
http://msdn.microsoft.com/en-us/library/dd183362%28v=VS.85%29.aspx[^]

Good luck!
 
Share this answer
 
Comments
Ivan Ivanov 83 3-Nov-10 13:12pm    
Superb :) Thank you very much! I'll consider both of those solutions.
More and more I get convinced that there is nothing wrong with my program and this is a BUG of Windows 7 itself!!!

- Firstly I saw this on oher (Dialog based resizing capable) programs, some of which cometial!
- Also after recent Windows Update part of this problem disappeared. The part that when I open a folder the face of the dialog that is inside the Tab control becomes white and it's sopposed to be this grey-brown color (the normal dialog color) while the background immediately behing any static text remains with the normal color which looks very ugly. Now after the update (Windows Update) this effect is gone! What remains is what I've described in the main body of my question.

I tested both solutions offered by the above answer and they both didn't work. I don't want to reject the solution because I'm not sure I did everything right and I have to test some more ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900