dbGrid是可以用户填充颜色的,由于每行数据性质不一样我在cxGrid里也想做到,请大家帮忙,给出源码。

解决方案 »

  1.   


    [email protected]
    联系我,我发给你
      

  2.   

    如何使满足条件的数据显示不同的颜色?
    解决:
    var
    AYellowStyle: TcxStyle;procedure TForm1.FormCreate(Sender: TObject);
    begin
     //行颜色
    AYellowStyle := TcxStyle.Create(Self);
    AYellowStyle.Color := $0080FFFF;
    AYellowStyle.TextColor := clMaroon;
    end;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时就显示黄色
      

  3.   

    同上。。
    if vartostr(ARecord.Values[8]) ='已审' then
      AStyle := AYellowStyle;ARecord.Values[8] :cxgrid中第8列的值。。