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

# TCustomGrid.DrawCellGrid

Draws cell grid lines for the control.

## Declaration

Source position: grids.pas line 1057

`protected procedure TCustomGrid.DrawCellGrid(`
`aCol: Integer;`
`aRow: Integer;`
`aRect: TRect;`
`aState: TGridDrawState`
`); virtual;`

## Arguments

`aCol` |  | Column number for the cell.
`aRow` |  | Row number for the cell.
`aRect` |  | Rectangle with the screen coordinates for the cell.
`aState` |  | State for the cell (normal, fixed, pushed, et. al.).

## Description

DrawCellGrid is a procedure used to draw cell grid lines for both a fixed and a non-fixed cell in the grid control.

DrawCellGrid ensures that the control Canvas (and its Pen) are updated to use the values needed to draw the fixed or non-fixed cell at the location specified in ACol and ARow.

For a fixed cell (when gdFixed is in AState), grid lines are drawn when gdoFixedVertLine or gdoFixedHorzLine is found in the Options property. The Pen in the control Canvas is updated to reflect a non-zero value in GridLineWidth.

When Flat is set to False, the value in AState is used to determine the color used for the Pen. Canvas drawing methods, like MoveTo and LineTo, are used to draw the cell grid lines at the coordinates in ARect. The value in UseRightToLeftAlignment determines how values in ARect are adjusted for the operation.

When Flat is set to True, the value in FixedGridLineColor is used as the color for the Pen.

For a non-fixed cell (gdFixed is not in AState), grid lines are drawn when gdoVertLine or gdoHorzLine is found in the Options property. The Pen in the control Canvas is updated to use the GridLineWidth, GridLineStyle, and GridLineColor for the control. Canvas drawing methods, like MoveTo and LineTo, are used to draw the cell grid lines at the coordinates in ARect. The value in UseRightToLeftAlignment determines how values in ARect are adjusted for the operation.

DrawCellGrid is called from the DrawCell method after preparing the Canvas and drawing the filled rectangle with the background for the cell.

## See also

TCustomGrid.Options |  | Contains the set of optional features and/or behaviors enabled for the grid control.
TCustomGrid.DrawCell |  | Draws a cell using a given state at the specified grid location (Col, Row, rectangle).
TCustomGrid.Flat |  | Indicates if cells are displayed using a Flat appearance.
TCustomGrid.FixedGridLineColor |  | Color used to draw the separator lines for fixed grid cells.
TCustomGrid.GridLineColor |  | Color used for the grid lines on the control.
TCustomGrid.GridLineStyle |  | Style used to draw the grid lines on the control.
TCustomGrid.GridLineWidth |  | Width (thickness) for grid lines drawn on the control.
TControl.UseRightToLeftAlignment |  | True when BiDiMode is bdRightToLeft.