title | description | ms.assetid | ms.topic | ms.date |
---|---|---|---|---|
Using Theme Subclasses |
Theme classes that represent controls such as ComboBox, Edit, ExplorerBar, Rebar, Tab, and Toolbar can be subclassed in order to provide theme variations for that particular control. |
4f5e26c1-72ae-48de-a407-9ac3c0d5f502 |
article |
05/31/2018 |
Theme classes that represent controls such as ComboBox, Edit, ExplorerBar, Rebar, Tab, and Toolbar can be subclassed in order to provide theme variations for that particular control. For example, the Button class is subclassed as Start::Button
in order to provide control over the theme applied to the Start button.
Note
Use caution when you create subclasses like those that are discussed in this topic. Because subclasses might be altered or unavailable in subsequent versions of Windows, you are discouraged from using them.
An application can use a subclassed theme in one of these two ways:
- It can use the OpenThemeData function with a string of the form
subclass::class
in the pszClassList parameter. - It can call SetWindowTheme with the theme subclass name in the pszSubAppName parameter.
Certain controls, such as Rebar and Toolbar, provide specific messages that you can send to instruct the control to use a theme subclass. For those controls, provide a pointer to a buffer that contains the theme subclass name in the lParam parameter of the message. Use the generic CCM_SETWINDOWTHEME message, or use a specific variant like those shown in the following table.
Control | Message |
---|---|
Tooltip | TTM_SETWINDOWTHEME |
Toolbar | TB_SETWINDOWTHEME |
Rebar | RB_SETWINDOWTHEME |
ComboBoxEx | CBEM_SETWINDOWTHEME |
The following table lists some of the subclasses that Windows Vista defines.
Class | Subclasses |
---|---|
ComboBox |
|
Edit |
|
Rebar |
|
Tab |
|
Toolbar |
|
In Windows Vista, the subclasses of certain classes internal to Windows Internet Explorer and Windows Explorer are available even though the classes themselves are not. The following table lists the available subclasses.
Class | Subclass |
---|---|
AddressBand |
|
SearchBox |
|
The following table shows the specifics of these classes.
Control | Part | States |
---|---|---|
ADDRESSBAND | ABBACKGROUND | NORMAL (0x1), HOT (0x2), DISABLED (0x3), FOCUSED (0x4) |
SEARCHBOX | SBBACKGROUND | NORMAL (0x1), HOT (0x2), DISABLED (0x3), FOCUSED (0x4) |