HBRUSH CreateSolidBrush(clrref) | ||||
COLORREF clrref; | /* brush color, */ |
The CreateSolidBrush function creates a brush that has a specified solid color. The brush can subsequently be selected as the current brush for any device.
clrref
Specifies the color of the brush.
The return value is the handle of the brush if the function is successful. Otherwise, it is NULL.
When an application has finished using the brush created by CreateSolidBrush, it should select the brush out of the device context and then remove it by using the DeleteObject function.
The following example uses the CreateSolidBrush function to create a green brush, selects the brush into a device context, and then uses the brush to fill a rectangle:
HBRUSH hbrOld;
HBRUSH hbr;
hbr = CreateSolidBrush(RGB(0, 255, 0));
hbrOld = SelectObject(hdc, hbr);
Rectangle(hdc, 10, 10, 100, 100);
CreateBrushIndirect, CreateDIBPatternBrush, CreateHatchBrush, CreatePatternBrush, DeleteObject