在StringGrid的OnDrawCell事件中:procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var
  S:string;
  R:TRect;
begin
  S:=StringGrid1.Cells[ACol, ARow];
  R:=Rect;
  with StringGrid1 do
    DrawText(Canvas.handle,PChar(S),-1,R,DT_WORDBREAK); //自动按单词换行
end; 

解决方案 »

  1.   

    我也贴,:)
    int DrawText(    HDC hDC, // handle to device context 
        LPCTSTR lpString, // pointer to string to draw 
        int nCount, // string length, in characters 
        LPRECT lpRect, // pointer to structure with formatting dimensions  
        UINT uFormat // text-drawing flags 
       ); DT_WORDBREAK    Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-linefeed sequence also breaks the line