Right edge border unpainted & theme drawing on non client area
Posted
by
CodeVisio
on Stack Overflow
See other posts from Stack Overflow
or by CodeVisio
Published on 2012-09-01T18:14:44Z
Indexed on
2012/09/01
21:38 UTC
Read the original article
Hit count: 397
Basically, the problem concerns border flickering during window resizing on Windows.
My first goal was to repositioning controls on a dialog during resizing of it.
I think I got a good dynamic repositioning without almost any flickering during this operation, but here I'm talking about main window border flickering.
However, I wasn't able to eliminate it at all.
To simplify the example try to create a simple win32 app with default code VS provided.
I'm testing it on Window 7(64bit) with the default theme (Windows 7 basic, no transparency) and VS2008.
1) Do not add code to the app.
2) run it in debug mode.
3) Drag the left edge of the window slowly toward the left of the screen and at the same time keep an eye on the right edge border of the window. You should see a redrawing taking in action.
4) Repeat step 3 moving rapidly the mouse, you should see the flickering on the right edge more clearly.
If you invert the edge, that is moving the right edge of the window, then the left edge stay firmly there without unpainted regions. The same process happens for the top edge border vs. the bottom one.
Now, enable he Classic Theme (that similar to Win2000) and repeat again the steps above. The right edge is perfectly there without flickering at all! If you keep an eye in the Output Window of Visual Studio when you run in debug mode you should see a list of dll loaded together with your exe. If you run in debug mode with the default theme you will see uxtheme.dll loaded. On the contrary, with classic theme enabled the uxtheme.dll is not loaded (dwmapi.dll is always loaded). Probably uxtheme.dll is loaded at runtime, based on desktop settings and it takes in action for redrawing your windows non-client area.
Another trick you could use to see the effect of this flickering is to add a case for WM_NCPAINT and return 0 instead to call the DefWindowProc(). Repeating the steps above and moving fast you should see a big part of the right edge of the window completely erased by background windows. This doesn't happen for the top and bottom ones.
Any idea to resolve this flickering?
Thank you!
© Stack Overflow or respective owner