change the DefaultRowHeight of a TDBGrid?

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
change the DefaultRowHeight of a TDBGrid?
// 1. Way: Derive a new Type: TMyDBGrid
type
TMyDBGrid = class(TDBGrid)
public
property DefaultRowHeight;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
 
procedure TForm1.FormCreate(Sender: TObject);
begin
DbGrid1.Canvas.Font.Size := 13;
TMyDBGrid(DBGrid1).DefaultRowHeight := DBGrid1.Canvas.TextHeight('MMMMM') + 4;
end;
 
// 2. Way: Make a TypeCast:
procedure TForm1.Button1Click(Sender: TObject);
begin
DBGrid1.DataSource.DataSet.DisableControls;
TStringGrid(DBGrid1).DefaultRowHeight := 55;
DBGrid1.DataSource.DataSet.EnableControls;
end;
 

Similar threads

A
回复
0
查看
981
Andreas Hausladen
A
A
回复
0
查看
964
Andreas Hausladen
A
I
回复
0
查看
461
import
I
后退
顶部