Board index » delphi » HELP: Text wrapping

HELP: Text wrapping

Hi,

I seem to remember that it is possible to have windows automatically wrap
text into a bounding rectangle. I can't find the function/procedure I need.

I have variable length strings ( with paragraphs as well) that need to be
printed from a given position on the page (proportional font - arial in my
case).

Can anyone help.

Thanks,
Jim

 

Re:HELP: Text wrapping


In article <g0silskcmf47ig8npouorknoh2394tu...@4ax.com>,
jim_ea...@mimotopes.com says...
Quote
> I seem to remember that it is possible to have windows automatically wrap
> text into a bounding rectangle.

The DrawTextEx() function is especially useful, because it can give you
the necessary SIZE of the rectangle if you use the DT_CALCRECT flag. You
set the rectangle's width as desired, set its height to 0, and call
DrawTextEx() with the DT_CALCRECT and DT_WORDBREAK flags. Then possibly
adjust positions on your form and call again without that flag.

Other useful flags are DT_END_ELLIPSIS, which causes DrawText to end a
line with ellipsis (...) if it doesn't fit the space, DT_EXPANDTABS, and
DT_NOPREFIX (which suppresses special processing of ampersand).
--
Neil J. Rubenking
Contributing Technical Editor
PC Magazine

Other Threads