64.1.4 Pattern Brush

A pattern brush is a brush created from an application-defined bitmap or DIB (Device Independent Bitmap). The following illustration shows three rectangles that were painted with three different pattern brushes:

Three Pattern Brush Examples

In order to create a pattern brush, you need to first create a bitmap. (For a description of bitmaps, DIBs, and the functions that create them, see Chapter 63, “Bitmaps.”) Once you've created a bitmap, you can create a logical pattern-brush by calling the CreatePatternBrush or CreateDIBPatternBrush function and supplying the handle that identifies a bitmap (or DIB). The brushes that appear in the previous illustration were created from 8-by-8 pixel monochrome bitmaps.