CGDIPen Class

class CGDIPen: public CGDIObject

Encapsulates a GDI pen handle

Defined in: GDIObjects.h

Class Members

CGDIPen(HPEN h = NULL, bool bOwn = true)

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

CGDIPen(CGDIPen& rhs, bool bTransferOwnership = true)

Copy constructor. Takes an existing CGDIPen 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.

CGDIPen(int nPenStyle, int nWidth, COLORREF cr)

Creation constructor. Takes the parameters necessary to create a GDI pen object and attaches it to the new instance.

CGDIPen& operator =(CGDIPen& rhs)

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

CGDIPen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush, int nStyleCount = 0, const DWORD* lpStyle = NULL )

Extended creation constructor. Creates a GDI pen using the parameters passed, and attaches it to the new instance.

bool CreatePen(int nPenStyle, int nWidth, COLORREF crColor)

Creates a simple, solid color pen

bool CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush,int nStyleCount = 0, const DWORD* lpStyle = NULL)

Creates an extended pen

bool CreatePenIndirect(LPLOGPEN lpLogPen)

Creates a pen indirectly, based on the LOGPEN data struct

int GetLogPen(LOGPEN* pLogPen)

Returns the LOGPEN structure associated with this pen

int GetExtLogPen(EXTLOGPEN* pLogPen)

Returns the EXTLOGPEN structure that describes this pen.