DBGrid 更变数据内容显示

1.把DBGRID的第一列更变内容显示

  if   Column.FieldName= 'OPERATORID' then
  if DataCol = 0 then
  begin
    DBGrid2.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, IntToStr(i));
     inc(i);
  end;

//I:显示了其顺序号。

 

 如:

procedure TfrmDetail01.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn;
  State: TGridDrawState);
var
  str:string;
begin
  inherited;

  if DataCol = 7 then
  begin
    if cds1.FieldByName('ReductFlag').AsInteger=1 then
      str:='已扣款'
    else
      str:='未扣款';
    DBGrid1.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, str);
    Exit;
  end;

end;

posted @ 2012-05-29 15:39  yoogoo  阅读(329)  评论(0编辑  收藏  举报