void InvalidateRgn( CRgn* pRgn, BOOL bErase = FALSE );
pRgn
Identifies the region to be added to the update region. The region is assumed to have client coordinates.
bErase
Specifies whether the background within the update region is to be erased.
Invalidates the client area within the given region by adding it to the current update region of CWnd. The invalidated region, along with all other areas in the update region, is marked for painting when the WM_PAINT message is next sent. The invalidated areas accumulate in the update region until the region is processed when WM_PAINT is next sent, or the region is validated by using the ValidateRect or ValidateRgn member function.
The bErase parameter specifies whether the background within the update area is to be erased when the update region is processed. If bErase is TRUE, the background is erased when the BeginPaint member function is called; if bErase is FALSE, the background remains unchanged. If bErase is TRUE for any part of the update region, the background in the entire region is erased, not just in the given part.
Windows sends WM_PAINT whenever the CWnd update region is not empty and there are no other messages in the application queue for that window.
The given region must have been previously created by using one of the region functions.
CWnd::BeginPaint, CWnd::ValidateRect, CWnd::ValidateRgn, ::InvalidateRgn