Delphi textrect wordwrap

I am using Canvas.TextRect in Delphi 7 to display something on the screen.

I need the text to be a word enclosed in a rectangle.

+3
source share
2 answers

You need to use DrawText (or DrawTextEx) with the DT_WORDBREAK flag.

See the sample in this thread .

+9
source

Use

DrawText( hdc, pchar(s), length(s), rcRect, DT_NOPREFIX or DT_WORDBREAK);

Where

s: print string

rcRect: TRect the rectangle in which the line should be printed.

0
source

Source: https://habr.com/ru/post/1721471/


All Articles