DrawThemeText Function


This is preliminary documentation and is subject to change.

Draws the text using the theme-defined color and font.

Syntax

HRESULT DrawThemeText(
    HTHEME hTheme, 
    HDC hdc, 
    int iPartId, 
    int iStateId, 
    LPCWSTR pstrText, 
    DWORD dwCharCount, 
    DWORD dwTextFlags, 
    DWORD dwTextFlags2, 
    const RECT *pRect
);

Parameters

hTheme
Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME.
hdc
Handle to a device context to use for drawing.
iPartId
Integer that specifies the part which contains the text.
iStateId
Integer that specifies the state of the part.
pstrText
Pointer to a string that contains the text to draw.
dwCharCount
DWORD that contains the number of characters to draw.
dwTextFlags
These flags may be one or more of the following:
DT_BOTTOM
Justifies the text to the bottom of the rectangle. This value is used only with the DT_SINGLELINE value.
DT_CALCRECT
Determines the width and height of the rectangle.
DT_CENTER
Centers text horizontally in the 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 displayed text and adds ellipses if the end of a string does not fit in the rectangle. If a word goes beyond the limits of the rectangle, it is truncated without ellipses. 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 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 ampersand (&) prefix character in the text. The letter that follows is not underlined, but other mnemonic-prefix characters are still processed. For example: input string: "A&bc&&d" normal: "Abc&d" DT_HIDEPREFIX: "Abc&d"
DT_INTERNAL
Uses the system font to calculate text metrics.
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 without clipping.
DT_NOFULLWIDTHCHARBREAK
Prevents a line break at a double-wide character string (DBCS), so that the line breaking rule is equivalent to single-byte character strings (SBCS). For example, this can be used in Korean windows to make icon labels more readable. This value has no effect unless DT_WORDBREAK is specified.
DT_NOPREFIX
Turns off processing of prefix characters.
DT_PATH_ELLIPSIS
Replaces characters in the middle of displayed text with ellipses so that the result fits in the specified 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 ampersand (&) prefix character. Does not draw any other characters in the string. 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 with 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. Bits 15–8 (high-order byte of the low-order word) of the uFormat parameter specify the number of characters for each tab. The default number of characters per tab is eight. The DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values cannot be used with the DT_TABSTOP value.
DT_TOP
Justifies the text to the top of the rectangle.
DT_VCENTER
Centers text vertically. This value is used only with the DT_SINGLELINE value.
DT_WORDBREAK
Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line.
DT_WORD_ELLIPSIS
Truncates any word that does not fit in the rectangle and adds ellipses.
dwTextFlags2
The value for this flag is:
DTT_GRAYED 0x1
Draws a grayed-out string.
pRect
Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the text is to be drawn.

Return Value

Returns S_OK if successful, or an error value otherwise.

Function Information

Stock ImplementationUxTheme.dll
Custom ImplementationNo
HeaderThemeApi.h
Import libraryUxTheme.lib
Minimum operating systems Windows NT Whistler


© 2000 Microsoft Corporation. All rights reserved. Terms of use.