Skip to content

Basic Concepts

nptr edited this page Jan 22, 2023 · 8 revisions

Themes

Themes are the overarching configuration items. They are a selection of mouse cursor, wallpaper, some system icons, sound schema and the actual visual style. It's what you can select and see in the "Personalization" control panel. Technically they are simple text files located in C:\Windows\Resources\Themes. Creating customized themes is easy, but you are limited to these basic settings. The interesting things are inside the visual styles.

Visual Style

Visual styles define a great part of the appearance of the user interface. Unfortunately Microsoft doesn't provide users access to visual styles and doesn't even make use of them or their capabilities very often. They are binary files located in C:\Windows\Resources\Themes\<folder>\<name>.msstyles and require tools such as msstyleEditor to modify.

Understanding the logical structure of visual styles is crucial when using this program. Fortunately its quite simple. A visual style consists of classes, parts, states and properties. Properties are the actual configuration parameters while classes, parts and states provide structure. The figure below should give you a good idea how visual styles work.

├─ Class 1 (e.g. Button, Window)
│   └─ Part 1 (e.g. Pushbutton, Left Frame)
│      ├─ State 1 (e.g. Pressed, Disabled)
│      └─ State 2
│          ├─ Property 1 (e.g. BackgroundColor, Margins)
│          └─ Property 2
├─ Class 2
│    ├─ Part 1
│    └─ Part 2
└─ Class 3

This is basically what you see in msstyleEditor. No abstraction over the internals is done. Things are named and structured as they were by the developers at Microsoft.

Classes, Parts, States and Properties

You already saw that the properties are structured top-down in a tree-like fashion. The toplevel items are called Classes and assemble all the settings that make up a class of control or other "large" object. In the figure above you saw examples such as Button or Window.

The next level of items are called "Parts". They typically represent parts of the larger object they belong to. Examples are FRAMELEFT (left frame) and MAXBUTTON (maximize button) for the Window class. Parts can only "hold" states; the lowest level of grouping.

States as the name lets suspect, represent the states (a part of) a control can be in. The FRAMELEFT part of our Window can be in states ACTIVE and INACTIVE for example. Depending on the state a control is in, Windows uses the properties from that state to paint it. Properties shared across states are in a special "non-state" that msstyleEditor calls Common.

The screenshot below shows the location of the aforementioned items in msstyleEditors UI.

Ui of the msstyleEditor

Inheritance

You will also encounter classes with :: in their names, such as BrowserTab::Tab. This means that the BrowserTab class inherits the parts, properties and states of Tab, and just defines a few that override existing ones or are an addition. With this concept, duplication of properties is minimized and further provides a single place for common properties.