取得cxgrid的表格的值,仔细看下面的代码

procedure TfrmMain.cxGridDBTableView_List_PSSJCustomDrawCell(Sender:
TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo:
TcxGridTableDataCellViewInfo; var ADone: Boolean);

  var strValue:string;
  var iRow,iRol,iI:Integer;
begin
  //这是找到了当前数据行
  iRow :=AViewInfo.RecordViewInfo.Index;
  iRol := -1;
  //如何根据Caption找到列
  with (Sender as TcxGridDBTableView) do
  begin
    for iI := 0 to ColumnCount-1 do
    begin
      if UpperCase(Columns[iI].DataBinding.FieldName)='加急' then
      begin
        iRol := iI;
        Break;
      end;
    end;
  end;

    if iRol >= 0 then
    begin
      strValue := VarToStr(cxGridDBTableView_List.DataController.GetValue(iRow, iRol));
      if strValue = 'T' then
      begin
        ACanvas.Brush.Color := clRed;
        ACanvas.Font.Color := clWhite;
      end;
    end;

end;
原文地址:https://www.cnblogs.com/westsoft/p/9796296.html