The SftStyle component shows every form of a Windows Forms application in dark mode or with the colors of the Windows contrast theme. One component on the main form is enough: it styles every form of the application's user interface thread, the forms that are open and those created later, including owned forms, dialogs and MDI child forms, and switches them when the mode changes, also when the Windows setting changes while they are open.
| Member | Description |
|---|---|
| SftStyle.DarkMode | DarkModeEnum.Off (the default), DarkModeEnum.On, or DarkModeEnum.Auto to follow the Windows setting for app mode (Settings, Personalization, Colors). |
| SftStyle.HighContrastMode | HighContrastModeEnum.Off (the default), HighContrastModeEnum.On, or HighContrastModeEnum.Auto to follow the Windows contrast theme. |
| SftStyle.DarkModeActive | Whether dark mode is in effect, the result of SftStyle.DarkMode and, with Auto, the Windows setting. While SftStyle.HighContrastActive is True the forms show the contrast theme instead, even if this property is True. |
| SftStyle.HighContrastActive | Whether high contrast is in effect, the result of SftStyle.HighContrastMode and, with Auto, the Windows contrast theme setting. |
| SftStyle.DarkModeChanged | Occurs when SftStyle.DarkModeActive changes. |
| SftStyle.HighContrastChanged | Occurs when SftStyle.HighContrastActive changes. |
| SftStyle.Styling | Occurs before a control is styled in dark mode; it can leave the control as it is (see The Styling Event). |
| SftStyle.Scaling | On .NET Framework, occurs before a form or a control is scaled for the DPI of its monitor; it can leave the form or the control as Windows Forms made it (see Per-Monitor DPI and Scaling). |
High contrast takes precedence over dark mode: while it is active, the forms are not styled, and Windows Forms draws them with the system colors of the contrast theme (see High Contrast). An application that follows both Windows settings sets both properties to Auto:
C#
sftStyle1.DarkMode = DarkModeEnum.Auto; sftStyle1.HighContrastMode = HighContrastModeEnum.Auto;
VB
SftStyle1.DarkMode = DarkModeEnum.Auto SftStyle1.HighContrastMode = HighContrastModeEnum.Auto
In dark mode the component gives the forms dark title bars, translates the colors of the forms and their standard controls, uses the dark Windows themes for scroll bars, buttons, check boxes and other parts, and draws menus and tool strips in dark colors. A color that is a system color (such as SystemColors.Window) is replaced by its dark counterpart; a color the application set itself (such as Color.LightYellow) stays. Standard Controls lists what each control looks like, .NET Framework and .NET 10 how the component works in each framework.
Controls of other Softel vdm products are not changed: they have their own DarkMode and HighContrastMode properties (see Controls of Other Softel vdm Products). That includes the SftSlider control of SftStyle/NET. The message box, the task dialog and the color dialog of SftStyle/NET use the component's mode.
Every application that uses SftStyle/NET has an SftStyle component, placed on its main form: it carries the license the Visual Studio designer saves with the form, which also licenses the dialogs (see Licensing and Contents). The component styles the forms of the thread that created it, which is the application's user interface thread; forms of other threads are not styled.
When an application has several SftStyle components, the one created or set last styles the forms: one on a second form takes over with its own mode when that form is created. When the component is disposed, for example because its form closes, the forms that remain open return to their light colors, unless another SftStyle component styles them; that is why it belongs on the main form.
At design time the component does not style the Visual Studio designer; its mode takes effect when the application runs.