CBrush::CBrush

CBrush( );

CBrush( COLORREF crColor );
throw( CResourceException );

CBrush( int nIndex, COLORREF crColor );
throw( CResourceException );

CBrush( CBitmap* pBitmap );
throw( CResourceException );

Parameters

crColor

Specifies the foreground color of the brush as an RGB color. If the brush is hatched, this parameter specifies the color of the hatching.

nIndex

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

pBitmap

Points to a CBitmap object that specifies a bitmap with which the brush paints.

Remarks

Has four overloaded constructors. The constructor with no arguments constructs an uninitialized CBrush object that must be initialized before it can be used.

If you use the constructor with no arguments, you must initialize the resulting CBrush object with CreateSolidBrush, CreateHatchBrush, CreateBrushIndirect, CreatePatternBrush, or CreateDIBPatternBrush. If you use one of the constructors that takes arguments, then no further initialization is necessary. The constructors with arguments can throw an exception if errors are encountered, while the constructor with no arguments will always succeed.

The constructor with a single COLORREF parameter constructs a solid brush with the specified color. The color specifies an RGB value and can be constructed with the RGB macro in WINDOWS.H.

The constructor with two parameters constructs a hatch brush. The nIndex parameter specifies the index of a hatched pattern. The crColor parameter specifies the color.

The constructor with a CBitmap parameter constructs a patterned brush. The parameter identifies a bitmap. The bitmap is assumed to have been created by using CBitmap::CreateBitmap, CBitmap::CreateBitmapIndirect, CBitmap::LoadBitmap, or CBitmap::CreateCompatibleBitmap. The minimum size for a bitmap to be used in a fill pattern is 8 pixels by 8 pixels.

CBrush OverviewClass MembersHierarchy Chart

See Also   CBrush::CreateSolidBrush, CBrush::CreateHatchBrush, CBrush::CreateBrushIndirect, CBrush::CreatePatternBrush, CBrush::CreateDIBPatternBrush, CGdiObject::CreateStockObject