GetThemeBackgroundContentRect function

Retrieves the size of the content area for the background defined by the visual style.

Syntax

THEMEAPI GetThemeBackgroundContentRect(
  HTHEME  hTheme,
  HDC     hdc,
  int     iPartId,
  int     iStateId,
  LPCRECT pBoundingRect,
  LPRECT  pContentRect
);

Parameters

hTheme

Type: HTHEME

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

hdc

Type: HDC

HDC to use when drawing. This parameter may be set to NULL.

iPartId

Type: int

Value of type int that specifies the part that contains the content area. See Parts and States.

iStateId

Type: int

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

pBoundingRect

Type: LPCRECT

Pointer to a RECT structure that contains the total background rectangle, in logical coordinates. This is the area inside the borders or margins.

pContentRect

Type: LPRECT

Pointer to a RECT structure that receives the content area background rectangle, in logical coordinates. This rectangle is calculated to fit the content area.

Return Value

Type: HRESULT

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

Remarks

A visual style can define a content area within each background image. This is the area where content such as text and icons can be placed without overwriting background borders.

Examples

When applying a theme to an entire client area of a window, you can call GetClientRect to retrieve this area in a RECT, which can be passed via pointer as the pContentRect parameter to GetThemeBackgroundContentRect as in the following example.

DWORD resultFlags = GetThemeAppProperties();
bool ctrlsAreThemed = ((resultFlags & STAP_ALLOW_CONTROLS) != 0);

Requirements

   
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

GetThemeBackgroundExtent

Property Identifiers

Reference