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. |
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() const;Allows a CRgn object to be used as a region handle (HRGN).
int GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const;Fills the specified buffer with data describing a region.
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.
int CombineRgn(HRGN hRgnSrc1, HRGN hRgnSrc2, int nCombineMode);
int CombineRgn(HRGN hRgnSrc, int nCombineMode);Combines two sepcified regions and stores the result.
int CopyRgn(HRGN hRgnSrc);Assigns the specified region to the current region.
HRGN CreateEllipticRgn(int x1, int y1, int x2, int y2);Creates an elliptical region.
HRGN CreateEllipticRgnIndirect(const RECT& rc);Creates an elliptical region.
HRGN CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData);Creates a region from the specified region and transformation data.
HRGN CreateFromPath(HDC hDC);Creates a region from the path that is selected into the specified device context. The resulting region uses device coordinates.
HRGN CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode);Creates a polygonal region.
HRGN CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode);Creates a region consisting of a series of polygons.
BOOL EqualRgn(HRGN hRgn) const;Creates a region consisting of a series of polygons. The polygons can overlap.
int OffsetRgn(int x, int y);
int OffsetRgn(POINT& pt);Moves a region by the specified offsets.
BOOL PtInRegion(int x, int y) const;
BOOL PtInRegion(POINT& pt) const;Determines whether the specified point is inside the specified region.
BOOL RectInRegion(const RECT& rc) const;Determines whether the specified rect is inside the specified region.
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 |