An update region defines the part of the client area that is marked for painting on the next WM_PAINT message. The purpose of the update region is to save applications the time it takes to paint the entire contents of the client area. If only the part that needs painting is added to the update region, only that part is painted. For example, if a word changes in the client area of a word-processing application, only the word needs to be painted, not the entire line of text. This saves the time it takes the application to draw the text, especially if there are many different sizes and fonts.
The InvalidateRect and InvalidateRgn functions add a given rectangle or region to the update region. The rectangle or region must be given in client coordinates. The update region itself is defined in client coordinates. Windows adds its own rectangles and regions to a window's update region after operations such as moving, sizing, and scrolling the window.
The ValidateRect and ValidateRgn functions remove a given rectangle or region from the update region. These functions are typically used when the window has updated a specific part of the display in the update region before receiving the WM_PAINT message.
The GetUpdateRect function retrieves the smallest rectangle that encloses the
entire update region. The GetUpdateRgn function retrieves the update region
itself. These functions can be used to compute the current size of the update region to determine if painting is required.