CGDIBrush Class

class CGDIBrush: public CGDIObject

Encapsulates a GDI brush object

Defined in: GDIObjects.h

Class Members

CGDIBrush(HBRUSH h = NULL, bool bOwn = true)

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

CGDIBrush(CGDIBrush& rhs, bool bTransferOwnership = true)

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

CGDIBitmap(COLORREF cr)

Creation constructor. Creates a solid brush of the color passed in.

CGDIBitmap(int nIndex, COLORREF cr)

Creation constructor. Creates a hatched pattern brush, with the pattern index given in nIndex and of color cr.

CGDIBitmap(HBITMAP hbmp)

Creation constructor. Creates a bitmap pattern brush, using the bitmap passed in.

CGDIBrush&  operator =(CGDIBrush& rhs)

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

bool  CreateSolidBrush(COLORREF crColor)

Create a solid brush

bool  CreateHatchBrush(int nIndex, COLORREF crColor)

Creates a hatched pattern brush

bool  CreateBrushIndirect(const LOGBRUSH* lpLogBrush)

Creates a brush using the LOGBRUSH structure

bool  CreatePatternBrush(CGDIBitmap& aBitmap)

Creates a bitmap pattern brush

bool  CreateDIBPatternBrush(HGLOBAL hPackedDIB, UINT nUsage)

Creates a DIB pattern brush

bool  CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage)

Creates a DIB pattern brush

bool  CreateSysColorBrush(int nIndex)

Creates a solid brush using a color in the system palette

int  GetLogBrush(LOGBRUSH* pLogBrush)

Retrieves the LOGBRUSH structure associated with this brush