OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Constructing TBrush

You can construct a TBrush either directly, by specifying the color, width, and style of the brush, or indirectly, by specifying a TBrush & or a pointer to a LOGBRUSH structure.

Directly constructing a brush creates a new object with the specified attributes. Here are the constructors for directly constructing a brush:

TBrush(TColor color);
TBrush(TColor color, int style);
TBrush(const TBitmap& pattern);
TBrush(const TDib& pattern);

The first constructor creates a solid brush with the color contained in color.

The second constructor creates a hatched brush with the color contained in color and the hatch style contained in style. style can be one of the following values:

  • HS_BDIAGONAL
  • HS_CROSS
  • HS_DIAGCROSS
  • HS_FDIAGONAL
  • HS_HORIZONTAL
  • HS_VERTICAL

The third and fourth constructors create a brush from the bitmap or DIB passed as a parameter. The width of the brush depends on the size of the bitmap or DIB.

Indirectly creating a brush also creates a new object, but copies the attributes of the object passed to it into the new brush object. Here are the constructors for indirectly creating a brush:

TBrush(const LOGBRUSH far* logBrush);
TBrush(const TBrush& src);

You can also create a new TBrush object from an existing HBRUSH handle:

TBrush(HBRUSH handle, TAutoDelete autoDelete = NoAutoDelete);

This constructor is used to obtain an ObjectWindows object as an alias to a regular Windows handle received in a message.

See Also