Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

GetThemeTextExtent function (uxtheme.h)

Calculates the size and location of the specified text when rendered in the visual style font.

Syntax

HRESULT GetThemeTextExtent(
 [in] HTHEME hTheme,
 [in] HDC hdc,
 [in] int iPartId,
 [in] int iStateId,
 [in] LPCWSTR pszText,
 [in] int cchCharCount,
 [in] DWORD dwTextFlags,
 [in] LPCRECT pBoundingRect,
 [out] LPRECT pExtentRect
);

Parameters

[in] hTheme

Type: HTHEME

Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME.

[in] hdc

Type: HDC

HDC to select the font into.

[in] iPartId

Type: int

Value of type int that specifies the part in which the text will be drawn. See Parts and States.

[in] iStateId

Type: int

Value of type int that specifies the state of the part. See Parts and States.

[in] pszText

Type: LPCWSTR

Pointer to a string that contains the text to draw.

[in] cchCharCount

Type: int

Value of type int that contains the number of characters to draw. If the parameter is set to -1, all the characters in the string are drawn.

[in] dwTextFlags

Type: DWORD

DWORD that contains one or more values that specify the string's formatting. See Format Values for possible parameter values.

[in] pBoundingRect

Type: LPCRECT

Pointer to a RECT structure that contains the rectangle used to control layout of the text. This parameter may be set to NULL.

[out] pExtentRect

Type: LPRECT

Pointer to a RECT structure that contains, in logical coordinates, the rectangle required to fit the rendered text.

Return value

Type: HRESULT

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header uxtheme.h
Library UxTheme.lib
DLL UxTheme.dll

See also

Property Identifiers


Feedback

Was this page helpful?

Additional resources