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

# TCustomGrid.DrawColumnTitleImage

Draws the image(s) used in the column title at the specified index in the grid.

## Declaration

Source position: grids.pas line 1066

`protected procedure TCustomGrid.DrawColumnTitleImage(`
`var ARect: TRect;`
`AColumnIndex: Integer`
`);`

## Arguments

`ARect` |  | Rectangle with the bounds for the column title.
`AColumnIndex` |  | Column Index for the title image drawn in the method.

## Description

DrawColumnTitleImage is a method used to draw the image(s) used in the column title at the index position in AColumnIndex. ARect contains the bounds for the cell where the image is drawn.

When AColumnIndex contains the same value as the SortColumn property, a sort indicator is drawn for the column. GetSortTitleImageInfo is called to determine whether theme services is used to drawn native sort buttons using theme element details. The image size may be scaled when the display density (PPI) for the control Font has a value other than 96.

DrawColumnTitleImage ensures that image padding (DEFIMAGEPADDING) is applied to the bounds in ARect. The top and bottom bounds are adjusted so that the image is vertically centered in the area in ARect.

DrawColumnTitleImage calls the DrawElement method in ThemeServices to draw the sort indicator.

When native sort indicators are not used for the column, an image scaled to the display density is retrieved from the image list. DrawColumnTitleImage ensures that image padding (DEFIMAGEPADDING) is applied to the bounds in ARect. The top and bottom bounds are adjusted so that the image is vertically centered in the area in ARect. The Draw method in the scaled image resolution is called to draw the image on the control Canvas.

TitleImageList is used to determine if an additional image is displayed for the column at AColumnIndex. When TitleImageList has been assigned, the GetTitleImageInfo method is called to get the image list and position used for the column. When an image is defined in Columns, an image scaled to the size size needed for the display density (PPI) is retrieved from TitleImageList. The bounds in ARect is adjusted to include padding around the image (DEFIMAGEPADDING) using the image layout for the column. The Draw method in the scaled image resolution is called to render the image to the control Canvas.

DrawColumnTitleImage is called from the DrawColumnText method.