第二个问题,请参照我一个程序的相关代码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); var i: integer; begin for i := 0 to ARecord.ValueCount - 1 do if ARecord.DisplayTexts[i]='衰耗大' then AStyle := AYellowStyle;end;
第二个问题,得在CustomDrawCell中写代码了
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);
var i: integer;
begin
for i := 0 to ARecord.ValueCount - 1 do if ARecord.DisplayTexts[i]='衰耗大' then
AStyle := AYellowStyle;end;
这里有很多学习的链接