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);

break;

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?

Recommended Answers

All 3 Replies

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 :)

Yes! This seems to have worked. Thanks :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.