zoukankan      html  css  js  c++  java
  • Delphi dbgrideh颜色设置

    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;

  • 相关阅读:
    2月24日-寒假进度24
    2月23日-寒假学习进度23
    2月22日-寒假学习进度22
    2月21日-寒假学习进度21
    第一周冲刺意见汇总
    团队绩效评估
    团队工作第七天
    团队工作第六天
    团队工作第五天
    团队工作第四天
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/2154662.html
Copyright © 2011-2022 走看看