procedure Tfrm_select_case_model_other.dw_1CustomDrawCell(
 Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
 AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
  ARec: TRect;
begin
 if AViewInfo.Focused then
 begin
   ARec := AViewInfo.Bounds;
   ACanvas.canvas.brush.color:= clSkyBlue;
   ACanvas.Font.Color := clRed;
   ACanvas.FillRect(ARec);
 end
 else
 begin
   ARec := AViewInfo.Bounds;
   ACanvas.canvas.brush.color:= clWhite;
   ACanvas.Font.Color := clBlack;
   ACanvas.FillRect(ARec);
 end;

end;


var
  ARec: TRect;
  i:integer;
begin
  if AViewInfo.Focused then
  begin
   ARec := AViewInfo.Bounds;
   ACanvas.canvas.brush.color:= clSkyBlue;
   ACanvas.Font.Color := clRed;
   ACanvas.FillRect(ARec);
  end
  else
  begin
   ARec := AViewInfo.Bounds;
   ACanvas.canvas.brush.color:= clWhite;
   ACanvas.Font.Color := clBlack;
   ACanvas.FillRect(ARec);
  end;
  if (AViewInfo.Item.Index = 18) or (AViewInfo.Item.Index = 19) or
    (AViewInfo.Item.Index = 33) or (AViewInfo.Item.Index = 34) or
    (AViewInfo.Item.Index = 48) or (AViewInfo.Item.Index = 49) then
  begin
    ARec := AViewInfo.Bounds;
    ACanvas.canvas.brush.color:= clSkyBlue;
    ACanvas.FillRect(ARec);
  end;
  if (AViewInfo.Item.Index >= 6) and (AViewInfo.Item.Index <= 19) then
  for i := 6 to 19 do
  begin
    if vartostr(AViewInfo.RecordViewInfo.GridRecord.Values[i])= '-' then
    begin
      ARec := AViewInfo.Bounds;
      ACanvas.Font.Color := clRed;
      ACanvas.FillRect(ARec);
    end;
  end;
  if (AViewInfo.Item.Index >= 21) and (AViewInfo.Item.Index <= 34) then
  for i := 21 to 34 do
  begin
    if vartostr(AViewInfo.RecordViewInfo.GridRecord.Values[i]) = '-' then
    begin
      ARec := AViewInfo.Bounds;
      ACanvas.Font.Color := clRed;
      ACanvas.FillRect(ARec);
    end;
  end;



procedure TFm_Rkcx.GD_RkcxBTCustomDrawCell(Sender: TcxCustomGridTableView;
 

ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
 var ADone: Boolean);
var ATextToDraw:String;
  ARec: TRect;
begin
 ATextToDraw := AViewInfo.GridRecord.DisplayTexts[AViewInfo.Item.Index];
 ARec := AViewInfo.Bounds;
 if AViewInfo.GridRecord.Values[6]<1000 then
  ACanvas.Canvas.Font.Color := clRed;
 //整行变色:ACanvas.Canvas.brush.color:=clred;  
 {列的颜色交替
  if AViewInfo.Item.Index mod 2 = 0 then
   ACanvas.Canvas.brush.color := clInfoBk
  else
  ACanvas.Canvas.brush.color := clInactiveCaptionText;
 }
 {行的颜色交替
   if AViewInfo.RecordViewInfo.Index mod 2 = 0 then
  ACanvas.Canvas.brush.color := clInfoBk
 else
  ACanvas.Canvas.brush.color := clInactiveCaptionText; 
 } 
 ACanvas.Canvas.FillRect(ARec);
end;


如果第一个字段的值小于125,用红色背景显示,文字为居中显示

procedure TForm1.cxGrid1DBTableView1CustomDrawCell(
 Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
 AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
   if StrToInt(AViewInfo.GridRecord.DisplayTexts[0])<125 then
    begin
      ACanvas.Brush.Color:=clRed;
      ACanvas.FillRect(AViewInfo.Bounds);
      ACanvas.DrawText(AViewInfo.GridRecord.DisplayTexts[AViewInfo.Item.Index], AViewInfo.Bounds, cxAlignHCenter);
      ADone:=true;
    end;
end;