delphi textrect wordwrap
问题 I am using Canvas.TextRect in Delphi 7 to output something on the screen. I need my text to be word wrapped in the rectangle. 回答1: You need to use DrawText (or DrawTextEx) with the DT_WORDBREAK flag. See the sample in this thread. 回答2: Use DrawText( hdc, pchar(s), length(s), rcRect, DT_NOPREFIX or DT_WORDBREAK); where s : string to print rcRect : TRect the rect wherein the string should be printed. 来源: https://stackoverflow.com/questions/1648277/delphi-textrect-wordwrap