...show TDBgrid title column captions in two rows?
Author: Thomas Stutz
type
TAccessDBGrid = class(TDBGrid);
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
S1, S2: String;
begin
with TAccessDBGrid(DBGrid1) do
begin
// Increase title height
// Titelhöhe vergrössern
RowHeights[0] := 32;
Canvas.Brush.Style := bsClear;
// Column Titles
// Spalten Titel setzen
case Column.Index of
0: begin
Column.Title.Caption := '';
S1 := 'Row 1';
S2 := 'Row 2';
end;
1: begin
Column.Title.Caption := '';
S1 := 'Row 1';
S2 := 'Row 2';
end;
end;
// write title:
// Titel ausgeben:
Canvas.TextOut(Rect.Left+2, 2, S1);
Canvas.TextOut(Rect.Left+2, 16, S2);
end;
end;
printed from
www.swissdelphicenter.ch
developers knowledge base