Clipping

Started by
0 comments, last by zoggo 19 years, 8 months ago
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?
Advertisement
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.

This topic is closed to new replies.

Advertisement