CBrush();
CBrush( DWORD crColor )
throw( CResourceException );
CBrush( int nIndex, DWORD crColor )
throw( CResourceException );
CBrush( CBitmap* pBitmap )
throw( CResourceException );
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:
Value | Meaning |
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 |
pBitmap
Points to a CBitmap object that specifies a bitmap with which the brush paints.
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 DWORD 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.
CBitmap::CreateBitmap, CBitmap::CreateBitmapIndirect, CBitmap::LoadBitmap, CBitmap::CreateCompatibleBitmap, CBrush::CreateSolidBrush, CBrush::CreateHatchBrush, CBrush::CreateBrushIndirect, CBrush::CreatePatternBrush, CBrush::CreateDIBPatternBrush, CGdiObject::CreateStockObject