delphi textrect wordwrap

萝らか妹 提交于 2020-01-03 20:48:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!