Sign in to follow this  
normal31337guy

Clipping

Recommended Posts

When Windows sends me the WM_PAINT message because another window is covering my client area, I use the BeginPaint() and EndPaint() functions to help me begin repainting my window. The invalid rectangle is the area that is covered by another window, is this also known as the clipping rectangle or am I getting confused with something else?

Share this post


Link to post
Share on other sites
Windows doesn't send WM_PAINT because a window is covering your client area, it sends it because a window which was covering your client area has revealed a previously hidden part of your client area. The invalid or dirty rectangle is known, simply, as the update rectangle in MSDN. (Actually, Windows sends WM_PAINT messages for a whole host of other reasons as well but that's probably the most common one)

You can query the current update rectangle during WM_PAINT using the GetUpdateRect which returns the size of, assuming one exists, the current update rectangle.

Drawing during WM_PAINT is usually clipped to the update rectangle by a clipping rectangle, but it doesn't have to be. You can repaint the whole client area if you want to.

Share this post


Link to post
Share on other sites

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