Format Values
This section lists the values that are used with the dwTextFlags parameter of the DrawThemeText and GetThemeTextExtent functions. One or more of these values are used to specify how a text string should be formatted. The DrawThemeText function will draw the text string inside a display rectangle, specified by the pRect parameter. The GetThemeTextExtent function can be used to determine the necessary bounding rectangle for text of a given length and format.
Format Values
The following table lists the format values.
Value | Description |
---|---|
DT_BOTTOM | Renders the text string at the bottom of the display rectangle. This value is used only with the DT_SINGLELINE value. |
DT_CALCRECT | Determines the width and height of the display rectangle. |
DT_CENTER | Centers text horizontally in the display rectangle. |
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_END_ELLIPSIS | Truncates a text string that is wider than the display rectangle and adds an ellipsis to indicate the truncation. The string is not modified unless the DT_MODIFYSTRING flag is specified. |
DT_EXPANDTABS | Expands tab characters. The default number of characters per tab is eight. The DT_WORD_ELLIPSIS, DT_PATH_ELLIPSIS, and DT_END_ELLIPSIS values cannot be used with the DT_EXPANDTABS value. |
DT_EXTERNALLEADING | Includes the external leading of a font in the line height. Normally, external leading is not included in the height of a line of text. |
DT_HIDEPREFIX | Ignores the prefix character & in the text. The letter that follows is not underlined, but other prefix characters are still processed. For example: input string: "A&bc&&d" normal: "Abc&d" DT_HIDEPREFIX: "Abc&d" |
DT_LEFT | Aligns text to the left. |
DT_MODIFYSTRING | Modifies a string to match the displayed text. This value has no effect unless DT_END_ELLIPSIS or DT_PATH_ELLIPSIS is specified. |
DT_NOCLIP | Draws the text string without clipping the display rectangle. |
DT_NOFULLWIDTHCHARBREAK | Prevents a line break at a double-byte character set (DBCS), so that the line-breaking rule is equivalent to single-byte character set (SBCS). This can be used, for example, to make icon labels written in Korean text more readable. This value has no effect unless DT_WORDBREAK is specified. |
DT_NOPREFIX | Turns off processing of prefix characters. Normally, DrawThemeText interprets the prefix character & as a directive to underscore the character that follows, and the prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off. For example: input string: "A&bc&&d" normal: "Abc&d" DT_NOPREFIX: "A&bc&&d" |
DT_PATH_ELLIPSIS | Replaces characters in the middle of text with an ellipsis so that the result fits in the display rectangle. If the string contains backslash (\) characters, DT_PATH_ELLIPSIS preserves as much as possible of the text after the last backslash. The string is not modified unless the DT_MODIFYSTRING flag is specified. |
DT_PREFIXONLY | Draws only an underline at the position of the character following the prefix character &. Normally DrawThemeText interprets the & as a directive to underline the character that follows and the prefix characters && as a directive to print a single &. By specifying DT_PREFIXONLY, no characters are drawn, only an underline. White spaces are placed in the positions where characters would normally appear. For example: input string: "A&bc&&d" normal: "Abc&d DT_PREFIXONLY: " " |
DT_RIGHT | Aligns text to the right. |
DT_RTLREADING | Lays out text in right-to-left order for bidirectional text, for example, text in a Hebrew or Arabic font. The default direction for text is left-to-right. |
DT_SINGLELINE | Displays text on a single line. Carriage returns and line feeds do not break the line. |
DT_TABSTOP | Sets tab stops. |
DT_TOP | Renders the text at the top of the display rectangle. |
DT_VCENTER | Centers text vertically. This value is used only with the DT_SINGLELINE value. |
DT_WORDBREAK | Breaks lines between words if a word would extend past the edge of the display rectangle. A carriage return/line feed (CR/LF) sequence also breaks the line. |
DT_WORD_ELLIPSIS | Truncates any word that does not fit in the display rectangle and adds an ellipsis. |