CGDIRgn Class

class CGDIRgn: public CGDIObject

Encapsulates a GDI region object.

Defined in: GDIObjects.h

Class Members

CGDIRgn(HRGNh = NULL, bool bOwn = true)

Attach constructor. Initializes a new instance of CGDIRgn and optionally attaches a previously existing bitmap handle. The ownership of this handle is determined by the bOwn parameter.

CGDIRgn(CGDIRgn& rhs, bool bTransferOwnership = true)

Copy constructor. Takes an existing CGDIRgn instance and copies its contents to the new instance being constructed. If the object being copied is the owner of the handle, ownership's transference is controlled by the parameter bTransferOwnership.

CGDIRgn& operator =(CGDIRgn& rhs)

Copies the contents of the passed object into this instance. Ownership is always transfered if it belongs to the object being copied.

bool CreateRectRgn(int x1, int y1, int x2, int y2)

Creates a rectangular region

bool CreateRectRgnIndirect(LPCRECT lpRect)

Creates a rectangular region

bool CreateEllipticRgn(int x1, int y1, int x2, int y2)

Creates an elliptical region

bool CreateEllipticRgnIndirect(LPCRECT lpRect)

Creates an elliptical region

bool CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode)

Creates a polygonal region

bool CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode)

Creates a polygonal region

bool CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3)

Creates a round rectangular region

bool CreateFromPath(HDC hdc)

Creates a region from the path selected in the given DC

bool CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData)

Creates a region from the given region and transformation data

void SetRectRgn(int x1, int y1, int x2, int y2)

Changes the region to a rectangular region with the specified coordinates

void SetRectRgn(LPCRECT lpRect)

Changes the region to a rectangular region with the specified coordinates

int CombineRgn(CGDIRgn& aRgn1, CGDIRgn& aRgn2, int nCombineMode)

Combines the two given regions using the given combine operation

int CopyRgn(CGDIRgn& aRgnSrc)

Copy the region passed in into this region

bool EqualRgn(CGDIRgn& aRgn) const

Compares the region passed in to this region

int OffsetRgn(int x, int y)

Displaces this region

int OffsetRgn(POINT point)

Displaces this region

int GetRgnBox(LPRECT lpRect) const

Smallest rectangle that contains the entire region

bool PtInRegion(int x, int y) const

Determines whether a given point is contained within this region

bool PtInRegion(POINT point) const

Determines whether a given point is contained within this region

bool RectInRegion(LPCRECT lpRect) const

Determines whether a given rectangle is contained within this region

int GetRegionData(LPRGNDATA lpRgnData, int nCount) const

Returns the region information encapsulated in a RGNDATA parameter