CreatePatternBrush

  HBRUSH CreatePatternBrush(hbmp)    
  HBITMAP hbmp;    

The CreatePatternBrush function creates a logical brush using the pattern specified by the hbmp parameter.

Parameters

hbmp

Identifies the bitmap.

Return Value

The return value identifies a logical brush if the function is successful. Otherwise, it is NULL.

Comments

A pattern brush is an 8-pixel by 8-pixel bitmap that Windows uses to paint the interior of filled objects.

Once an application has created a brush by calling CreatePatternBrush, it can select that brush into any device context by calling SelectObject.

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

A brush created using a monochrome (one bit per pixel) bitmap is drawn using the text and background colors of the device context it is drawn to. Pixels represented by a 0 bit will be drawn with the current text color, and pixels represented by a 1 bit will be drawn with the current background color.

See Also

CreateBitmap, CreateBitmapIndirect, CreateCompatibleBitmap, CreateDIBPatternBrush, CreateDIBPatternBrushPt, CreateHatchBrush, CreatePatternBrush, DeleteObject, GetBrushOrgEx, LoadBitmap, SelectObject, SetBrushOrgEx