Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CreateSolidBrush function

The CreateSolidBrush function creates a logical brush that has the specified solid color.

Syntax


HBRUSH CreateSolidBrush(
  _In_ COLORREF crColor
);

Parameters

crColor [in]

The color of the brush. To create a COLORREF color value, use the RGB macro.

Return value

If the function succeeds, the return value identifies a logical brush.

If the function fails, the return value is NULL.

Remarks

When you no longer need the HBRUSH object, call the DeleteObject function to delete it.

A solid brush is a bitmap that the system uses to paint the interiors of filled shapes.

After an application creates a brush by calling CreateSolidBrush, it can select that brush into any device context by calling the SelectObject function.

To paint with a system color brush, an application should use GetSysColorBrush (nIndex) instead of CreateSolidBrush(GetSysColor(nIndex)), because GetSysColorBrush returns a cached brush instead of allocating a new one.

ICM: No color management is done at brush creation. However, color management is performed when the brush is selected into an ICM-enabled device context.

Examples

For an example, see Creating Colored Pens and Brushes.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Brushes Overview
Brush Functions
CreateDIBPatternBrush
CreateDIBPatternBrushPt
CreateHatchBrush
CreatePatternBrush
DeleteObject
GetSysColorBrush
SelectObject
COLORREF
RGB

 

 

Show: