Reviewed and updated November 2018
The optional flags parameter is used to calculate the optimum rectangle size for the specified memo after reformatting it according to various options.
In this case, the rght and btm parameters are also returned, indicating the adjusted rectangle dimensions required for printing the memo string. For single line memos (TRF_SINGLELINE set, or TRF_WORDBREAK not set and no CRLFs in the line), the width of the rectangle will be adjusted to fit the text. Otherwise, if TRF_WORDBREAK is specified, it will preserve the width of the rectangle, breaking the lines as needed to fit within that width, and adjusting the height of the rectangle.
Formatting options for flags are chosen from the TRF_xxx flags used by //TEXTRECTANGLE (reprinted below), with the mandatory inclusion of the TRF_CALCRECT bit.
Flag |
Value |
Meaning |
TRF_TOP |
&h00000000 |
top justification |
TRF_LEFT |
&h00000000 |
left justification |
TRF_HCENTER |
&h00000001 |
horizontal centering |
TRF_RIGHT |
&h00000002 |
right justification |
TRF_VCENTER |
&h00000004 |
vertical centering |
TRF_BOTTOM |
&h00000008 |
bottom justification |
TRF_WORDBREAK |
&h00000010 |
wrap the text onto multiple lines |
TRF_SINGLELINE |
&h00000020 |
output text as a single line |
TRF_EXPANDTABS |
&h00000040 |
expand tabs (8 spaces each) |
TRF_NOCLIP |
&h00000100 |
no clipping |
TRF_EXTERNALLEADING |
&h00000200 |
incl. ext. leading in spacing |
TRF_CALCRECT |
&h00000400 |
calc only (use with MX_GDICALC) |
TRF_PATH_ELLIPSIS |
&h00004000 |
path ellipsis |
TRF_END_ELLIPSIS |
&h00008000 |
end ellipsis |
TRF_WORD_ELLIPSIS |
&h00040000 |
word ellipsis |
Definition file: ashell.def |