GetThemeMetric function (uxtheme.h)

Retrieves the value of a metric property.

Syntax

HRESULT GetThemeMetric(
  [in]  HTHEME hTheme,
  [in]  HDC    hdc,
  [in]  int    iPartId,
  [in]  int    iStateId,
  [in]  int    iPropId,
  [out] int    *piVal
);

Parameters

[in] hTheme

Type: HTHEME

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

[in] hdc

Type: HDC

HDC. This parameter may be set to NULL.

[in] iPartId

Type: int

Value of type int that specifies the part that contains the metric property. See Parts and States.

[in] iStateId

Type: int

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

[in] iPropId

Type: int

Value of type int that specifies the property to retrieve. Can be one of the following values.

Value Meaning
TMT_ALPHALEVEL
The alpha value (0-255) used for DrawThemeIcon.
TMT_ALPHATHRESHOLD
The minimum alpha value (0-255) that a pixel must be to be considered opaque.
TMT_BORDERSIZE
The thickness of the border drawn if this part uses a border fill.
TMT_GLYPHINDEX
The character index into the selected font that will be used for the glyph, if the part uses a font-based glyph.
TMT_GRADIENTRATIO1
The amount of the first gradient color to use in drawing the part. This value can be from 0 to 255, but this value plus the values of each of the GRADIENTRATIO values must add up to 255. See the TMT_GRADIENTCOLOR1 value of GetThemeColor.
TMT_GRADIENTRATIO2
The amount of the second gradient color to use in drawing the part.
TMT_GRADIENTRATIO3
The amount of the third gradient color to use in drawing the part.
TMT_GRADIENTRATIO4
The amount of the fourth gradient color to use in drawing the part.
TMT_GRADIENTRATIO5
The amount of the fifth gradient color to use in drawing the part.
TMT_HEIGHT
The height of the part.
TMT_IMAGECOUNT
The number of state images present in an image file.
TMT_MINDPI1
The minimum dpi that the first image file was designed for. See GetThemeFilename.
TMT_MINDPI2
The minimum dpi that the second image file was designed for.
TMT_MINDPI3
The minimum dpi that the third image file was designed for.
TMT_MINDPI4
The minimum dpi that the fourth image file was designed for.
TMT_MINDPI5
The minimum dpi that the fifth image file was designed for.
TMT_PROGRESSCHUNKSIZE
The size of the progress control "chunk" shapes that define how far an operation has progressed.
TMT_PROGRESSSPACESIZE
The total size of all of the progress control "chunks".
TMT_ROUNDCORNERWIDTH
The roundness (0-100%) of the part's corners.
TMT_ROUNDCORNERHEIGHT
The roundness (0-100%) of the part's corners.
TMT_SATURATION
The amount of saturation (0-255) to apply to an icon drawn using DrawThemeIcon.
TMT_TEXTBORDERSIZE
The thickness of the border drawn around text characters.
TMT_TRUESIZESTRETCHMARK
The percentage of a true-size image's original size at which the image will be stretched.
TMT_WIDTH
The width of the part.

[out] piVal

Type: int*

Pointer to an int that receives the metric property value.

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