我采用的自动换行:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  DrawText(StringGrid1.Canvas.Handle,pchar(StringGrid1.Cells[Acol,Arow]),Length(StringGrid1.Cells[Acol,Arow]),Rect,DT_WORDBREAK or DT_LEFT);
end;
为什么字迹会模糊呢?

解决方案 »

  1.   

    你设一下StringGrid1.Canvas的字体看看。
      

  2.   

    procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    begin
      StringGrid1.Canvas.Font.Color := clBlack;
      StringGrid1.Canvas.TextRect(rect, rect.Left, rect.Top,
        StringGrid1.Cells[acol, arow]);
      //前面加这两行试试
      DrawText(StringGrid1.Canvas.Handle,pchar(StringGrid1.Cells[Acol,Arow]),Length(StringGrid1.Cells[Acol,Arow]),Rect,DT_WORDBREAK or DT_LEFT);
    end;
      

  3.   

    StringGrid1.Canvas.FillRect(rect);
    画之前先清空一下。