Partager via


CBrush::CreateSolidBrush

Initializes a brush with a specified solid color.

BOOL CreateSolidBrush( 
   COLORREF crColor  
);

Parameters

  • crColor
    A COLORREF structure that specifies the color of the brush. The color specifies an RGB value and can be constructed with the RGB macro in WINDOWS.H.

Return Value

Nonzero if successful; otherwise 0.

Remarks

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

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

Example

See the example for CBrush::CBrush.

Requirements

Header: afxwin.h

See Also

Reference

CBrush Class

Hierarchy Chart

CBrush::CreateBrushIndirect

CBrush::CreateDIBPatternBrush

CBrush::CreateHatchBrush

CBrush::CreatePatternBrush

CreateSolidBrush

CGdiObject::DeleteObject