• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Delphidbgrideh颜色设置

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

dbgrideh颜色设置

(2010-06-30 10:30:59)
标签:

杂谈

(1)分行不同颜色设置;在DBGridEh1DrawColumnCell中写;

    if ADOQuery1.RecNo mod 2=0 then
    begin
        DBGridEh1.Canvas.Font.Color := clRed;
        DBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end
    else begin
        DBGridEh1.Canvas.Font.Color := clGreen;
        DBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;

(2)分行不同背景颜色设置;在DBGridEh1DrawColumnCell中写;

    if ADOQuery1.RecNo mod 2=0 then
    begin
        DBGridEh1.Canvas.Brush.Color := clRed;
        DBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end
    else begin
        DBGridEh1.Canvas.Brush.Color := clGreen;
        DBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;

(3)符合条件的单元格颜色或者背景颜色设置;在DBGridEh1DrawColumnCell中写;

    if Column.FieldName='价格' then
    begin
        if ADOQuery1.FieldByName('价格').AsFloat<0 then
        begin
            DBGridEh1.Canvas.Font.Color := clRed;
            DBGridEh1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
        end;
    end;


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab中设计低通滤波器 - 那抹阳光1994发布时间:2022-07-18
下一篇:
matlab 绘图字体大小控制 - Bin的专栏发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap