CRgn::CreateRectRgnIndirect
BOOLCreateRectRgnIndirect(LPCRECTlpRect**);**
Return Value
Nonzero if the operation succeeded; otherwise 0.
Parameters
lpRect
Points to a RECT structure or CRect object that contains the logical coordinates of the upper-left and lower-right corners of the region. The RECT structure has the following form:
typedef struct tagRECT {
int left;
int top;
int right;
int bottom;
} RECT;
Remarks
Creates a rectangular region that is stored in the CRgn object.
The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.
When it has finished using a region created by CreateRectRgnIndirect, an application should use the CGDIObject::DeleteObject member function to remove the region.
Example
CRgn rgnA, rgnB, rgnC;
CRect rectA(50, 50, 150, 150);
CRect rectB(100, 50, 200, 150);
VERIFY(rgnA.CreateRectRgnIndirect(&rectA));
VERIFY(rgnB.CreateEllipticRgnIndirect(&rectB));
VERIFY(rgnC.CreateRectRgn( 0, 0, 50, 50 ));
int nCombineResult = rgnC.CombineRgn( &rgnA, &rgnB, RGN_AND );
ASSERT( nCombineResult != ERROR || nCombineResult != NULLREGION );
CBrush brA, brB, brC;
VERIFY(brA.CreateSolidBrush( RGB(255, 0, 0) ));
VERIFY(pDC->FrameRgn( &rgnA, &brA, 2, 2 )); // rgnA Red
VERIFY(brB.CreateSolidBrush( RGB(0, 255, 0) ));
VERIFY(pDC->FrameRgn( &rgnB, &brB, 2, 2 )); // rgnB Green
VERIFY(brC.CreateSolidBrush( RGB(0, 0, 255) )); // rgnC Blue
VERIFY(pDC->FrameRgn( &rgnC, &brC, 2, 2 ));
CRgn Overview | Class Members | Hierarchy Chart
See Also CRgn::CreateRectRgn, CRgn::CreateRoundRectRgn,