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

# TCustomGrid.DrawGridCheckboxBitmaps

Draws a check box bitmap which represents the given state in a cell.

## Declaration

Source position: grids.pas line 1061

`protected procedure TCustomGrid.DrawGridCheckboxBitmaps(`
`const aCol: Integer;`
`const aRow: Integer;`
`const aRect: TRect;`
`const aState: TCheckBoxState`
`); virtual;`

## Arguments

`aCol` |  | Column number for the check box cell.
`aRow` |  | Row number for the check box cell.
`aRect` |  | Rectangle with the bounds for the cell.
`aState` |  | Checkbox state used to determine the bitmap drawn in the cell.

## Description

DrawGridCheckboxBitmaps is used to draw a bitmap used for a check box at the cell coordinates in ACol and aRow. AState contains the check box state for the cell, and determines the image displayed in the specified cell.

GetImageForCheckBox is called to get the image list, image index, and/or bitmap used in the cell. Use the OnUserCheckBoxImage or OnUserCheckboxBitmap event handler to get a custom image or bitmap displayed for the value in AState. If GetImageForCheckBox is unable to find either a bitmap or an image, ThemeServices is used to get the theme element details for the check box state.

The bitmap/image/theme element may be scaled if the control Font uses a display density (PPI) different than the value used for the Screen.

When Columns has been Enabled, the GetColumnAlignment and GetColumnLayout methods are used to determine the image alignment and layout used for the check box cell. If Columns has not been enabled, the image is centered horizontally in the cell using the vertical alignment defined for text on the Canvas.

DrawGridCheckboxBitmaps adjusts ARect to use the cell padding for the control (varCellPadding) along with the size, alignment and layout needed for the grid column.

The check box bitmap is drawn using the mechanism needed for the image source; ThemeServices.DrawElement, Canvas.StretchDraw, or TScaledImageListResolution.StretchDraw.

DrawGridCheckboxBitmaps is called from the DrawCellCheckboxBitmaps method.

## See also

TCustomGrid.Columns |  | Definitions for the columns displayed the grid.
TCustomGrid.GetImageForCheckBox |  | Gets the bitmap used to draw check box columns in the grid.
TCustomGrid.OnUserCheckBoxImage |  | Event handler signalled to get the user-defined image used for a check box cell.
TCustomGrid.OnUserCheckBoxBitmap |  | Event handler signalled to get the user-defined bitmap used for a check box cell.
TCustomDrawGrid.DefaultDrawCell |  | The default method used to draw the cell at the given position using a specific state.