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

# TCustomDBGrid.DoPrepareCanvas

Prepares the canvas and signals the OnPrepareCanvas event handler.

## Declaration

Source position: dbgrids.pas line 436

`protected procedure TCustomDBGrid.DoPrepareCanvas(`
`aCol: Integer;`
`aRow: Integer;`
`aState: TGridDrawState`
`); override;`

## Arguments

`aCol` |  | Column number for the operation.
`aRow` |  | Row number for the operation.
`aState` |  | Drawing state for the operation.

## Description

DoPrepareCanvas is an overridden procedure used to prepare the Canvas to draw a cell in the grid control. DoPrepareCanvas applies to data cells and performs no actions in the method when aRow refers to a fixed row in the control. In addition, DoPrepareCanvas applies only when DefaultDrawing contains False. No actions are performed in the method when DefaultDrawing is enabled.

DoPrepareCanvas calls GetSelectedState to determine if the Canvas is updated with brush and font colors used to draw in the specified state. DoPrepareCanvas signals the OnPrepareCanvas event handler (when assigned) using the specified column number and drawing state.

## See also

TCustomGrid.DoPrepareCanvas |  | Performs actions needed to prepare the canvas for a drawing operation.