CRgn

Win32++

CRgn Class

Description

The class responsible for creating and managing regions.

CRgn Members

Initialization and Assignment
CRgn
CRgn();
CRgn(HRGN hRgn);
Constructs a CRgn object.
FromHandle
static CRgn* FromHandle(HRGN hRgn);
Returns the CRgn associated with the specified region handle. If a CRgn object doesn't already exist, a temporary CRgn object is created. This temporary CRgn will be deleted sometime after the processing of the current message is complete. operator HRGN()
operator HRGN() const;
Allows a CRgn object to be used as a region handle (HRGN). Attributes GetRegionData
int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const;
Fills the specified buffer with data describing a region. GetRgnBox
int GetRgnBox(RECT& rc) const;
Retrieves the bounding rectangle of the region, and stores it in the specified RECT. The return value indicates the region's complexity: NULLREGION;SIMPLEREGION; or COMPLEXREGION. Operations CombineRgn
int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode);
int CombineRgn(HRGN hRgnSrc, int nCombineMode);
Combines two sepcified regions and stores the result. CopyRgn
int CopyRgn(HRGN hRgnSrc);
Assigns the specified region to the current region. CreateEllipticRgn
HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2);
Creates an elliptical region. CreateEllipticRgnIndirect
HRGN CreateEllipticRgnIndirect(const RECT& rc);
Creates an elliptical region. CreateFromData
HRGN CreateFromData(const XFORM* lpXForm, int nCount, 
                    const RGNDATA* pRgnData);
Creates a region from the specified region and transformation data. CreateFromPath
HRGN CreateFromPath(HDC hDC);
Creates a region from the path that is selected into the specified device context. The resulting region uses device coordinates. CreatePolygonRgn
HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode);
Creates a polygonal region. CreatePolyPolygonRgn
HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, 
                          int nCount, int nPolyFillMode);
Creates a region consisting of a series of polygons. EqualRgn
BOOL EqualRgn(HRGN hRgn) const;
Creates a region consisting of a series of polygons. The polygons can overlap. OffsetRgn
int OffsetRgn(int x, int y);
int OffsetRgn(POINT& pt);
Moves a region by the specified offsets. PtInRegion
BOOL PtInRegion(int x, int y) const;
BOOL PtInRegion(POINT& pt) const;
Determines whether the specified point is inside the specified region. RectInRegion
BOOL RectInRegion(const RECT& rc) const;
Determines whether the specified rect is inside the specified region. SetRectRgn
void SetRectRgn(int x1, int y1, int x2, int y2);
void SetRectRgn(const RECT& rc);
Converts the region into a rectangular region with the specified coordinates.
Base class Members

For base class members, refer to the members of CGDIObject.

Remarks

CRgn objects can be used anywhere a a handle to a region (HRGN) might be used.  They can be substituted for the HRGN in any of the Windows API functions which use a HRGN as a function argument.  The benefit of using a CRgn object is that it automatically deletes the palette when it is destroyed.

Refer to the Graphics Device Interface section of Using Win32++ for additional information on using this class.

Summary Information

Header file gdi.h
Win32/64 support Yes
WinCE support Yes