CBrush::CreatePatternBrush

Syntax

BOOL CreatePatternBrush( CBitmap* pBitmap );

Parameters

pBitmap

Identifies a bitmap.

Remarks

Initializes a brush with a pattern specified by a bitmap. The brush can subsequently be selected for any device context that supports raster operations. The bitmap identified by pBitmap is typically initialized by using the CBitmap::CreateBitmap, CBitmap::CreateBitmapIndirect, CBitmap::LoadBitmap, or CBitmap::CreateCompatibleBitmap function.

Bitmaps used as fill patterns should be 8 pixels by 8 pixels. If the bitmap is larger, Windows will only use the bits corresponding to the first 8 rows and columns of pixels in the upper-left corner of the bitmap.

A pattern brush can be deleted without affecting the associated bitmap. This means the bitmap can be used to create any number of pattern brushes.

A brush created using a monochrome bitmap (1 color plane, 1 bit per pixel) is drawn using the current text and background colors. Pixels represented by a bit set to 0 are drawn with the current text color. Pixels represented by a bit set to 1 are drawn with the current background color.

Return Value

TRUE if successful; otherwise FALSE.

See Also

CBrush::CreateBrushIndirect, CBrush::CreateDIBPatternBrush, CBrush::CreateHatchBrush, CBrush::CreateSolidBrush, CGdiObject::CreateStockObject, CBitmap::CreateBitmap, CBitmap::CreateBitmapIndirect, CBitmap::CreateCompatibleBitmap, CBitmap::LoadBitmap, ::CreatePatternBrush