把gdselected作为条件进行判断begin
  Coord := Column.Grid.MouseCoord(Rect.Left + 1,Rect.Top + 1);
  if gdselected in state then
  begin
    dbgAutoList.Canvas.Brush.Color := clwhite;
    dbgAutoList.Canvas.Font.Color := clred;
    dbgAutoList.Canvas.Brush.Color := clHighLight;
  end else
  begin
    if ((Coord.Y - 1) div 5) Mod 2 = 0 then
      dbgAutoList.Canvas.Brush.Color := clinfoBK
  end;
  dbgAutoList.DefaultDrawColumnCell(Rect,DataCol,Column,State);

解决方案 »

  1.   

    在dxdbgrid的oncustomdrawcell中 try
        with TColorDbgrid(sender) do
        begin
          if DataLink.ActiveRecord = Row - 1 then
            Canvas.Brush.Color := clinfobk;
          with DbG.DataSource.DataSet do
          begin        if (cb.text = '清算结果') or (cb.text = '证券库存') or (cb.text =
              '证券流水') then
            begin
              if (FieldByName('Gddm').asstring = '') or (FieldByName('zqdm').asstring
                =
                '') or (FieldByName('Gddm').isnull) or (FieldByName('zqdm').isnull)
                or (pos(FieldByName('zqdm').asstring, StrErrZqdm) <> 0) then
                Canvas.Font.Color := clred;
            end;
            if (cb.text = '资金帐户') or (cb.text = '资金流水') or (cb.text =
              '清算结果') then
              if (FieldByName('zjzh').asstring = '') then
                Canvas.Font.Color := clred;      end;
          DefaultDrawColumnCell(Rect, DataCol, Column, State);
        end;
      except on e: exception do
          showMessage(e.Message);
      end;
    看看,小改即可,我没空