| Discussion:
|
Prints the specified printable-text into the rectangle specified
by the coordinates left, top, right, bottom
using the format codes specified in flags.
Call this member function to format text in the given rectangle.
It formats text by expanding tabs into appropriate spaces, aligning
text to the left, right, or center of the given rectangle, and breaking
text into lines that fit within the given rectangle, and breaking text
into lines that fit within
the given rectangle. The type of formatting is specified by flags.
The formatting codes can be combined and are specified in flags.
| DT.TOP
| Specifies top-justified text (single line only).
|
| DT.LEFT
| Aligns text flush-left.
|
| DT.CENTER
| Centers text horizontally.
|
| DT.RIGHT
| Aligns text flush-right.
|
| DT.VCENTER
| Specifies vertically centered text (single line only).
|
| DT.BOTTOM
| Specifies bottom-justified text. This value must be
combined with DT.SINGLELINE.
|
| DT.WORDBREAK
| Specifies word-breaking. Lines are automatically
broken between words if a word would extend past the
edge of the rectangle specified by left, top,
right, bottom. A carriage return-linefeed sequence
will also break the line.
|
| DT.SINGLELINE
| Specifies single line only. Carriage returns and
linefeeds do not break the line.
|
| DT.EXPANDTABS
| Expands tab characters. The default number of
characters per tab is eight.
|
| DT.TABSTOP
| Sets tab stops. The high-order byte of PtrFlags is
the number of characters for each tab. The default
number of characters per tab is eight.
|
| DT.NOCLIP
| Draws without clipping. DrawText is somewhat faster
when DT.NOCLIP is used.
|
| DT.EXTERNALLEADING
| Includes the font's external leading in the line
height. Normally, external leading is not included
in the height of a line of text.
|
| DT.CALCRECT
| Returns the height of the formatted text, but does
not draw the text.
|
| DT.NOPREFIX
| Turns off processing of prefix characters. Normally,
DrawText interprets the ampersand (&) mnemonic-prefix
character as a directive to underscore the character
that follows, and the two-ampersand (&&) mnemonic-
prefix characters as a directive to print a single
ampersand. By specifying DT.NOPREFIX, this processing
is turned off.
|
| DT.INTERNAL
| Uses the system font to calculate text metrics.
|
| DT.EDITCONTROL
| Duplicates the text-displaying characteristics of a
multiline edit control. Specifically, the average
character width is calculated in the same manner as
for an edit control, and the function does not
display a partially visible last line.
|
| DT.PATH.ELLIPSIS
| See DT.END.ELLIPSIS Below
|
| DT.END.ELLIPSIS
| Replaces part of the given string with ellipses,
if necessary, so that the result fits in the
specified rectangle. The given string is not
modified unless the DT.MODIFYSTRING flag
is specified.
You can specify DT.END.ELLIPSIS to replace characters
at the end of the string, or DT.PATH.ELLIPSIS to replace
characters in the middle of the string. If the string contains
backslash (\) characters, DT.PATH.ELLIPSIS preserves as
much as possible of the text after the last backslash.
|
| DT.MODIFYSTRING
| Modifies the given string to match the displayed text.
This flag has no effect unless the DT_END_ELLIPSIS or
DT_PATH_ELLIPSIS flag is specified.
|
| DT.RTLREADING
| Layout in right to left reading order for bi-directional text when
the font selected into the hdc is a Hebrew or Arabic font.
The default reading order for all text is left to right.
|
| DT.WORD.ELLIPSIS
| Truncates text that does not fit in the rectangle and adds ellipses.
|
NOTE: The values DT.CALCRECT, DT.EXTERNALLEADING, DT.INTERNAL, DT.NOCLIP, and
DT.NOPREFIX cannot be used with the DT.TABSTOP value.
|