全部博文(788)
分类:
2009-05-12 16:04:35
1、Columns属性
2、OnDrawColumnCell事件
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var i :integer;
begin
if gdSelected in State then Exit;
for i :=0 to (Sender as TDBGrid).Columns.Count-1 do
begin
(Sender as TDBGrid).Columns[i].Title.Font.Name :='宋體';
(Sender as TDBGrid).Columns[i].Title.Font.Size :=12;
(Sender as TDBGrid).Columns[i].Title.Font.Color :=clNavy;
(Sender as TDBGrid).Columns[i].Title.Color :=$00FFC4C4;
end;
if query1.RecNo mod 2 = 0 then
(Sender as TDBGrid).Canvas.Brush.Color := clInfoBk
else
(Sender as TDBGrid).Canvas.Brush.Color := RGB(191, 255, 223);
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
with (Sender as TDBGrid).Canvas do begin
Pen.Color := $00ff0000;
MoveTo(Rect.Left, Rect.Bottom);
LineTo(Rect.Right, Rect.Bottom);
Pen.Color := clTeal;
MoveTo(Rect.Right, Rect.Top);
LineTo(Rect.Right, Rect.Bottom);
end;
end;
行高度怎么设置?标题行高度,记录行高度的设置方法?