在DElphi中的DataGrid怎样使它显示的行间隔改变颜色?就向.NET中同名控件一样

翻译|其它|编辑:郝浩|2005-01-19 11:17:00.000|阅读 2384 次

概述:

# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>


在DElphi中的DataGrid怎样使它显示的行间隔改变颜色?就向.NET中同名控件一样。

---------------------------------------------------------------

好像是在 OnDrawDataCell 事件中写代码。
---------------------------------------------------------------

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;
 


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP