CBrush Class

Encapsulates a Windows graphics device interface (GDI) brush.

class CBrush : public CGdiObject

Members

Public Constructors

Name

Description

CBrush::CBrush

Constructs a CBrush object.

Public Methods

Name

Description

CBrush::CreateBrushIndirect

Initializes a brush with the style, color, and pattern specified in a LOGBRUSH structure.

CBrush::CreateDIBPatternBrush

Initializes a brush with a pattern specified by a device-independent bitmap (DIB).

CBrush::CreateHatchBrush

Initializes a brush with the specified hatched pattern and color.

CBrush::CreatePatternBrush

Initializes a brush with a pattern specified by a bitmap.

CBrush::CreateSolidBrush

Initializes a brush with the specified solid color.

CBrush::CreateSysColorBrush

Creates a brush that is the default system color.

CBrush::FromHandle

Returns a pointer to a CBrush object when given a handle to a Windows HBRUSH object.

CBrush::GetLogBrush

Gets a LOGBRUSH structure.

Public Operators

Name

Description

CBrush::operator HBRUSH

Returns the Windows handle attached to the CBrush object.

Remarks

To use a CBrush object, construct a CBrush object and pass it to any CDC member function that requires a brush.

Brushes can be solid, hatched, or patterned.

For more information on CBrush, see Graphic Objects.

Inheritance Hierarchy

CObject

CGdiObject

CBrush

Requirements

Header: afxwin.h

See Also

Reference

CGdiObject Class

Hierarchy Chart

CBitmap Class

CDC Class

Concepts

MFC Sample PROPDLG