DbGridEh怎么设奇偶行的颜色不一样呢.......
解决方案 »
- 给第三方控件添加属性后,在Object Inspector不显示是什么原因?
- 请问Devexpress quntaumgrid 3.22 for d5控件哪里有下载?
- 有没有人使用delphi+MQSeries做三层结构的?
- 如何使Form保持透明?
- 请教高手如何在delphi里进行管理sql sever!!!(如果嫌分少的话,可以另给)
- 可不可以把RAVE生成的报表的菜单和工具栏提示改成中文的?(欢迎大家讨论)
- 软件公司用DELPHI主要是用于哪种开发?
- 500分,有没有把bmp做成avi的组件?
- 窗体上的“X”(关闭)的问题?
- 请问如何在程序中控制弹出式菜单的弹出和取消?
- 两个ACCESS之间的数据导入导出问题,总是出错!
- 关于数组的问题?菜
RowTwoColor := clYellow
RowColorFlat := True
const Rect: TRect; DataCol: Integer; Column: TbsColumn;
State: TGridDrawState);
begin
if adoquery3.RecordCount<1 then exit;
if adoquery3['单位名称']='合计' then
begin
bsskindbgrid2.Canvas.Font.Color:=clblue;
bsskindbgrid2.Canvas.Brush.color:=clyellow;
end;
if adoquery3['单位名称']='应交税金' then
begin
bsskindbgrid2.Canvas.Font.Color:=clblue;
bsskindbgrid2.Canvas.Brush.color:=$00D7DEEE;
end;if (DataCol=2) and (adoquery3.FieldByName('应收金额').AsFloat<0) then bsskindbgrid2.Canvas.Font.Color:=clred;
if (DataCol=3) and (adoquery3.FieldByName('应付金额').AsFloat<0) then bsskindbgrid2.Canvas.Font.Color:=clred;
if (DataCol=4) and (adoquery3.FieldByName('余额').AsFloat<0) then bsskindbgrid2.Canvas.Font.Color:=clred;bsskindbgrid2.DefaultDrawColumnCell(rect,datacol,column,state);end;
哪来的三个属性
RowOneColor := clHotLight
RowTwoColor := clYellow
RowColorFlat := True
DataCol: Integer; Column: TColumn; State: TGridDrawState);
Var
Row : integer;
begin
Row := DBGrid1.DataSource.DataSet.RecNo;
If (Row mod 2)<>0 Then
DBGrid1.Canvas.Brush.Color:=$00FF0000;
Else
DBGrid1.Canvas.Brush.Color:=$00FFFFC1;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
你看可以了吗?
AFont: TFont; val BackGround:TColor; TColumn; State: TGridDrawState);
begin
if ADODataSet1.RecNo mod 2=0 then
begin
Afont.color:=Clred;
Background:=Clblue;
end;
end;
可以显示不同字体和颜色,自己试吧
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with DBGrid1 do
begin
If (DataSource.DataSet.RecNo mod 2)<>0 Then
Canvas.Brush.Color:=$00FF0000;
Else
Canvas.Brush.Color:=$00FFFFC1;
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;