[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Graphics' (#lcl)

# TCanvas.CreateBrush

Ensures that the handle for the Brush is valid and configured with the Brush settings.

## Declaration

Source position: graphics.pp line 1072

`protected procedure TCanvas.CreateBrush; virtual;`

## Description

CreateBrush is a procedure used to create and/or configure handles for the canvas Brush.

SelectObject is called to get an existing Brush handle, and save a copy of the handle for local access in the canvas. Canvas state flags are updated to indicate that the Brush handle is valid.

The styles stored in Brush are checked for hatched-style brushes. When no hatch styles are used, the background color for the canvas is set to the color specified in Brush. If the Brush style is bsSolid, the background mode is set to OPAQUE. Otherwise, the TRANSPARENT background mode is used.