TAdvStringGrid
Example 39 : merged cell access and merged cell printing and HTML export

Example :
To set a long text in 10 horizontally merged cells you can:
AdvStringGrid1.MergeCells(1,6,10,1); AdvStringGrid1.Cells[1,6] := 'This another one that is long too';
The background color of this merged cell can be set by changing the background color of the base cell, ie :
AdvStringGrid.Colors[1,6] := clLime;
To reapply the default color, use :
AdvStringGrid.Colors[1,6] := clNone;
If you want to use the OnGetCellColor event to set colors, it is sufficient to handle the base cell color setting, for example in this way:
procedure AdvStringGrid1GetCellColor(Sender: TObject; ACol,ARow: Integer; AState: TGridDrawState; ABrush: TBrush; AFont: TFont); begin if ACol = 1 then begin AFont.Color := clBlue AFont.Style := [fsBold]; end; end;
Delphi project & source files for downloading included in the main demos distribution for Delphi.
×