Sign in to follow this  

Yet another simple Windows GDI question

This topic is 4033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I asked this before as part of a two part question, so I never got the answer to my second part of my two part question. The question is simply; In Windows GDI, is there a simple way (function or otherwise) to just "erase" all graphics in the window no matter what size it is? Or do I have to find the current size of the Window, fill that into a RECT, and draw a rectangle (with the RECT as the parameter) to fill everything in with pixels? Thanks!

Share this post


Link to post
Share on other sites
It depends on exactly how your app is structured. If you want to do the wipe immediately then yes you need to draw a rect with whatever your background color is.

The more traditional "Windows-y" way to do it would be to call InvalidateRect with a NULL rect pointer and bErase set to TRUE. This in turn would cause your app to get a WM_ERASEBKGND message which you could either handle or pass to DefWindowProc which would effectively do the wipe above with the background brush you specified in your WNDCLASS. You'd then get a paint message queue'd up to redraw whatever needed to be drawn.

There is no such thing as a true "erase" in the sense it sounds like you're thinking of. The pixels are always there. They are just background color or not.

Share this post


Link to post
Share on other sites

This topic is 4033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this