在delphi中的datagrid怎样使它显示的行间隔改变颜色
2个回答
2016-08-13
展开全部
请参考以下代码:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Table1.FieldByName('ext').Asstring<>'' then begin
DBGrid1.Canvas.Font.Color := clnavy;
// DBGrid1.Canvas.Font.Style:=[fsBold];
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
end;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2016-08-13
展开全部
procedure TForm1.dbgridDrawColumnCell(Sender:
TObject;
const Rect: TRect; DataCol:
integer; Column: TColumn;
State: TGridDrawState);
begin
if DBGrid2.DataSource.DataSet.RecNo mod 2 = 1 then
begin
DBGrid2.Canvas.Font.Color :=
clBlue;
DBGrid2.Canvas.Brush.Color :=
clyellow;
end
else
begin
DBGrid2.Canvas.Font.Color :=
clred;
DBGrid2.Canvas.Brush.Color :=
clGradientActiveCaption;
end;
DBGrid2.DefaultDrawColumnCell(Rect, DataCol, Column,
State);
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询