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

# TCustomDBGrid.PrepareCanvas

Prepares the Canvas to render the specified cell with the drawing state in aState.

## Declaration

Source position: dbgrids.pas line 496

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

## Arguments

`aCol` |  | Column number for the cell.
`aRow` |  | Row number for the cell.
`aState` |  | Grid draw state for the cell.

## Description

PrepareCanvas is an overridden method in TCustomDBGrid. It ensures that the Canvas is configured to use the drawing state in aState. PrepareCanvas calls the inherited PrepareCanvas method, and sets the brush color in the Canvas to the value needed for fixed or focused / selected columns.

PrepareCanvas is called from the DrawCell method. It occurs before default drawing is performed, and before the OnDrawColumnCell or OnDrawColumnTitle event handlers are signalled.

## See also

TCustomDBGrid.DrawCell |  | DrawCell renders the specified grid cell using the specified drawing state.
TCustomDBGrid.OnDrawColumnCell |  | Event handler signalled when a cell needs to be drawn.
TCustomDBGrid.OnDrawColumnTitle |  | Event handler signalled when a cell title needs to be drawn.
TCustomDBGrid.OnDrawColumnTitle |  | Event handler signalled when a cell title needs to be drawn.
TCustomDBGrid.OnPrepareCanvas |  | Event handler signalled to prepare the grid canvas for drawing a cell.
TCustomDBGrid.DoPrepareCanvas |  | Prepares the canvas and signals the OnPrepareCanvas event handler.
TCustomGrid.PrepareCanvas |  | Prepares the canvas for drawing the cell at the specified location.
TCustomGrid.DoPrepareCanvas |  | Performs actions needed to prepare the canvas for a drawing operation.