不改表结构的基础上如何在DBGrid里把相同的数据屏蔽掉
例:
 1   2   3  wer   fdf  nh
 1   2   3  rfdf  nh   44
 1   2   3  ref   nhf  544
显示为:
 1   2   3  wer   fdf  nh
            rfdf  nh   44
            ref   nhf  544

解决方案 »

  1.   

    在数据集的字段的OnGetText事件实现。
    或者你用自画也行。
    procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
      const Rect: TRect; DataCol: Integer; Column: TColumn;
      State: TGridDrawState);
    begin
      with DBGrid1.Canvas do
      Case  Column.Index of    // 列号
       0, 1, 2 :
        begin
          if 第四列的值为(wer) then
            begin
              DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
            end
          else
            begin     
              FillRect(Rect);
              TextOut(Rect.Left+2, Rect.Top+2, '');
            end      
        end
      else
        DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
    end;
      

  2.   

    里面的参数如果为数据具体怎么设置??? 谢谢rect,datacol,column,state,分别举下例子行不行