Share via


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:

  • HS_BDIAGONAL   Downward hatch (left to right) at 45 degrees

  • HS_CROSS   Horizontal and vertical crosshatch

  • HS_DIAGCROSS   Crosshatch at 45 degrees

  • HS_FDIAGONAL   Upward hatch (left to right) at 45 degrees

  • HS_HORIZONTAL   Horizontal hatch

  • HS_VERTICAL   Vertical hatch

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, , CBrush::CreateSolidBrush, , CGdiObject::DeleteObject