HBRUSH CreatePatternBrush(hBitmap)
This function creates a logical brush that has the pattern specified by the hBitmap param-eter. The brush can subsequently be selected for any device that supports raster operations. For more information, see the RC_BITBLT raster capability in the GetDeviceCaps function, later in this chapter.
Parameter | Type/Description | |
hBitmap | HBITMAP Identifies the bitmap. It is assumed to have been created by using the CreateBitmap, CreateBitmapIndirect, LoadBitmap, or CreateCompatibleBitmap function. The minimum size for a bitmap to be used in a fill pattern is 8-by-8. |
The return value identifies a logical brush if the function is successful. Otherwise, it is NULL.
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 plane, one bit per pixel) bitmap is drawn using the current text and background colors. Pixels represented by a bit set to 0 will be drawn with the current text color, and pixels represented by a bit set to 1 will be drawn with the current background color.