Sign in Join
FPDoc Onlineexperiment

TCustomGrid.DrawGridCheckboxBitmaps procedure

Member of TCustomGridprotectedIn unit Grids

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

Declaration

pascal
procedure 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.