I am trying to paint my own form by using the following code:

case WM_PAINT:

hDC = BeginPaint(hWnd, &ps);

hBrush = CreateSolidBrush(RGB(255,0,0));
FillRect(hDC, &ps.rcPaint, hBrush);

EndPaint(hWnd, &ps);


My problem is, that when you resize the form or drag it around, you can still see it flash grey between paints....
Is there a way to interrupt the regular painting routine so that I can paint it myself seamlessly?

8 Years
Discussion Span
Last Post by Clockowl

Hmm, im not sure if this is exactly what you need, but perhaps you should take a look at WM_ERASEBKGND, it is this message which automatically erases your background when resizing or doing some sort of activity with your window, by doing this manually, you should be able to remove the gray flash.

Hope this helps :)


To save some resources you could also try and not redraw when resizing, only when it's done resizing. No clue as of how, but I know it's possible.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.