共用方式為


CWnd::InvalidateRgn

Invalidates the client area within the given region by adding it to the current update region of CWnd.

void InvalidateRgn(
   CRgn* pRgn,
   BOOL bErase = TRUE 
);

Parameters

  • pRgn
    A pointer to a CRgn object that identifies the region to be added to the update region. The region is assumed to have client coordinates. If this parameter is NULL, the entire client area is added to the update region.

  • bErase
    Specifies whether the background within the update region is to be erased.

Remarks

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 a WM_PAINT message is next sent, or until the region is validated by 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, not just in the given part, is erased.

Windows sends a WM_PAINT message 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 one of the region functions.

Requirements

Header: afxwin.h

See Also

Reference

CWnd Class

Hierarchy Chart

CWnd::BeginPaint

CWnd::ValidateRect

CWnd::ValidateRgn

InvalidateRgn

CWnd::Invalidate

CWnd::InvalidateRect

Concepts

CWnd Members