Draws the border and fill defined by the visual style for the specified control part.
Syntax
HRESULT DrawThemeBackground(
HTHEME hTheme,
HDC hdc,
int iPartId,
int iStateId,
const RECT *pRect,
const RECT *pClipRect
);
Parameters
- hTheme
-
[in] Handle to a window's specified theme data. Use OpenThemeData to create an HTHEME.
- hdc
-
[in] Handle to a device context (HDC) used for drawing the theme-defined background image.
- iPartId
-
[in] Value of type int that specifies the part to draw. See Parts and States.
- iStateId
-
[in] Value of type int that specifies the state of the part to draw. See Parts and States.
- pRect
-
[in] Pointer to a >RECT structure that contains the rectangle, in logical coordinates, in which the background image is drawn.
- pClipRect
-
[in] Pointer to a RECT structure that contains a clipping rectangle. This parameter may be set to NULL.
Return Value
Returns S_OK if successful, or an error value otherwise.
Remarks
Drawing operations are scaled to fit and not exceed the rectangle specified in pRect. Your application should not draw outside the rectangle specified by pClipRect.
Example
Prior to calling DrawThemeBackground to draw the background image for a window, you may call IsThemeBackgroundPartiallyTransparent. This method determines whether DrawThemeParentBackground should be called to draw in backgrounds behind partially-transparent or alpha-blended child controls, and is demonstrated in the following example.
if (_hTheme)
{
if (IsThemeBackgroundPartiallyTransparent(_hTheme, BP_PUSHBUTTON, _iStateId))
{
DrawThemeParentBackground(_hwnd, hdcPaint, prcPaint);
}
DrawThemeBackground(_hTheme,
hdcPaint,
BP_PUSHBUTTON,
_iStateId,
&rcClient,
prcPaint);
}
Function Information
| Stock Implementation | UxTheme.dll |
|---|
| Custom Implementation | No |
|---|
| Header | uxtheme.h |
|---|
| Import library | UxTheme.lib |
|---|
| Minimum operating systems |
Windows XP |
|---|
See Also
Property Identifiers