假设cxgrid为cxMain,TableView为ViewSelData,现在要根据数据集的colColorMark来改变本行的颜色,则可在ViewSelData的OnCustomDrawCell写入
if AViewInfo.RecordViewInfo.GridRecord.Values[colColorMark.Index] = null then Exit;
case AViewInfo.RecordViewInfo.GridRecord.Values[colColorMark.Index] of
1: ACanvas.Brush.Color := $FF0080;
2: ACanvas.Brush.Color := $C0C0C0;
3: ACanvas.Brush.Color := $FFFF80;
4: ACanvas.Brush.Color := $ABAF8F;
5: ACanvas.Brush.Color := $CA31CE;
6: ACanvas.Brush.Color := $E6E8D7;
end;