//表格单元格/行颜色变更 procedure TForm1.cxgrdbtblvw_TestSqueCustomDrawCell( Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean); var ARec: TRect; begin //单元格变化 if (AViewInfo.GridRecord.Values[AViewInfo.Item.Index]='Pass') then begin ACanvas.Canvas.brush.Color := clGreen; ACanvas.FillRect(AViewInfo.Bounds); end; //行变化 if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Pass' then begin ARec := AViewInfo.Bounds; ACanvas.canvas.brush.color:= clGreen; ACanvas.FillRect(ARec); end; if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Fail' then begin ARec := AViewInfo.Bounds; ACanvas.Brush.Color:= clRed; ACanvas.FillRect(ARec); end; if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index]='Testing' then begin ARec := AViewInfo.Bounds; ACanvas.Brush.Color:= clOlive; ACanvas.FillRect(ARec); end; if AViewInfo.RecordViewInfo.GridRecord.Values[cxgrdbclmn_TestSque_Result.Index] ='' then begin ARec := AViewInfo.Bounds; ACanvas.Brush.Color:= clMoneyGreen; ACanvas.FillRect(ARec); end; end;
|
|