Export (0) Print
Expand All
Expand Minimize
1 out of 2 rated this helpful - Rate this topic

DrawThemeBackground function

Draws the border and fill defined by the visual style for the specified control part.

Syntax


HRESULT DrawThemeBackground(
  _In_  HTHEME hTheme,
  _In_  HDC hdc,
  _In_  int iPartId,
  _In_  int iStateId,
  _In_  const RECT *pRect,
  _In_  const RECT *pClipRect
);

Parameters

hTheme [in]

Type: HTHEME

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

hdc [in]

Type: HDC

HDC used for drawing the theme-defined background image.

iPartId [in]

Type: int

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

iStateId [in]

Type: int

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

pRect [in]

Type: const RECT*

Pointer to a RECT structure that contains the rectangle, in logical coordinates, in which the background image is drawn.

pClipRect [in]

Type: const RECT*

Pointer to a RECT structure that contains a clipping rectangle. This parameter may be set to NULL.

Return value

Type: HRESULT

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

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.

Examples

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);
}


Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

Header

Uxtheme.h

Library

UxTheme.lib

DLL

UxTheme.dll

See also

Property Identifiers

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.