Class: TEgDBGridEx
property OnBeforeDrawCell: TEgDBGridBeforeDrawCellEvent;
Fired once per cell, for every column type, just before it is filled
and painted, whenever assigned. Use Column.Field to
identify the underlying field - nil for a Custom Cell
column (empty FieldName). FontColor,
BackColor, and Font arrive already resolved to
what the cell would normally use (selection, VCL Style, and column
colors already applied); change them to override. Font is
the actual Canvas.Font about to be used, not a copy, so
changing
Name/Size/Style/Color
on it takes effect directly.
CellText, ImageIndex, and
ImageAlignment arrive pre-filled with whatever that column
would show by default:
DisplayText.MemoMaxChars).Field):
''/-1 - this event is the only source of
content for this column type.Null, or which
failed to decode as a recognized image format: '' for
CellText (never a (BLOB)-style placeholder,
regardless of Null-ness), with
ImageIndex/ImageAlignment ready to show a
fallback icon in the usual way.CellText is always '' (the decoded
image already fills the cell, so there is no text to show), but
ImageIndex/ImageAlignment are still meaningful
- a non--1 ImageIndex is drawn as an icon
overlaid on top of the image, not suppressed by it. See
ImageIndex
for how that overlay is positioned.ftGraphic, non-Memo/CLOB) BLOB
field, whether or not DetectBlobImages
applies to it: CellText is always '',
Null or not - this event is the only way to put text on
such a column.A checkbox cell ignores all three, since it always draws its own glyph.
CellText is passed through the same
<var>VarID</var> placeholder resolution used
elsewhere in the grid (see OnGetVariableValue)
before being painted, for every column kind except Memo/CLOB - so a
value this handler assigns to CellText can itself contain
<var>FieldName</var> markers and have them
resolved normally.
Replaces the older OnDrawCustomCell, which only covered
Custom Cell columns and had no color/font control. Also available at
column level (see TEgColumn.OnBeforeDrawCell);
when both are assigned, the grid-level handler runs first. See TEgDBGridBeforeDrawCellEvent.