zoukankan      html  css  js  c++  java
  • 如何使满足条件的数据显示不同的颜色

    如何使满足条件的数据显示不同的颜色?

    解决:

    var  AYellowStyle: TcxStyle;
    
    procedure TForm1.FormCreate(Sender: TObject); 
    begin
     //行颜色       
      AYellowStyle := TcxStyle.Create(Self);
    AYellowStyle.Color := $0080FFFF;
    AYellowStyle.TextColor := clMaroon; e
    nd
    ; procedure TForm1.cxGrid1DBBandedTableView1StylesGetContentStyle(Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
    AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
    begin
      if ARecord.Values[cxGrid1DBBandedTableView1Lengthcm.Index] < 81 then
      AStyle := AYellowStyle;
    end;

    这里cxGrid1DBBandedTableView1Lengthcm.Index小于81时就显示黄色

    procedure TForm1.cxGrid1DBTableView1CustomDrawCell(
      Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
      AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
    begin
      //Item确定列(ID列的索引),RecordViewInfo确定行(Index行的索引)
      //可以定位到某一行改变颜色
     {if (AViewInfo.Item.ID = 0) and (AViewInfo.RecordViewInfo.Index = 0) then
        ACanvas.Brush.Color := clred;}
      //可以根据条件值确定改变某行颜色
     if (trim(AViewInfo.RecordViewInfo.GridRecord.Values[4]) = 'HTT') 
        and (AViewInfo.Item.ID = 4) //确定到某一列,如果不加确定是某行底色
        then
        ACanvas.Brush.Color := clred;
    end;
  • 相关阅读:
    96. 不同的二叉搜索树
    95. 不同的二叉搜索树 II
    94. 二叉树的中序遍历
    93. 复原IP地址
    python-007(用户登录(三次机会重试))
    python-006求1-2+3-4+5.....99的所有数的和
    python006(求1-2+3-4+5.....99的所有数的和)
    python-005(1-100奇数和偶数)
    python-004(while循环)
    python-003(if...elif...else)
  • 原文地址:https://www.cnblogs.com/karkash/p/3833317.html
Copyright © 2011-2022 走看看