CBrush::CreateSysColorBrush

BOOL CreateSysColorBrush( int nIndex );

Return Value

Nonzero if successful; otherwise 0.

Parameters

nIndex

Specifies the hatch style of the brush. It can be any one of the following values:

Remarks

Initializes a brush color. The brush can subsequently be selected as the current brush for any device context.

When an application has finished using the brush created by CreateSysColorBrush, it should select the brush out of the device context.

Example

// Declare a CBrush and initialize to a system color.
CBrush brush;
brush.CreateSysColorBrush(COLOR_BTNFACE);

// Select the brush into the device context. 
CBrush* pOldBrush = (CBrush*)pDC->SelectObject(&brush);

// Draw.
CRect rect(50, 50, 150, 150);
pDC->Rectangle(rect);

// Reselect the original brush.
pDC->SelectObject(pOldBrush);

CBrush OverviewClass MembersHierarchy Chart

See Also   CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CBrush::CreateHatchBrush, CBrush::CreatePatternBrush, ::CreateSolidBrush, CBrush::CreateSolidBrush, ::GetSysColorBrush, CGdiObject::DeleteObject