如何消去delphi Stringgrid重绘时产生重影

procedure TForm1.Stringgrid1DrawCell(Sender: TObject;
  ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  with Sender as TStringGrid do
  begin
    Canvas.FillRect(Rect);
    DrawText(Canvas.Handle, Pchar(Cells[ACol, ARow]),
      Length(Cells[ACol, ARow]), Rect,
      DT_CENTER or DT_SINGLELINE or DT_VCENTER);
  end;
end;

 

如果有重影把stringgrid1.deaultdrawing := False;

 

posted on 2018-07-11 13:39  天军  阅读(328)  评论(0编辑  收藏  举报

导航