Styles every form of the application in dark mode or with the colors of the Windows contrast theme.
Add one SftStyle component to the main form of the application. It styles every form of the application's user interface thread, the forms that are open and those created later, and switches them when the mode changes, also when the Windows setting changes while they are open.
On .NET Framework, SftStyle styles the forms and their standard controls itself. On .NET 10 and later, it uses the dark mode of Windows Forms (Application.SetColorMode) and styles the controls Windows Forms leaves light. An application using SftStyle does not call Application.SetColorMode.
Controls of other Softel vdm products have their own dark mode and high contrast settings and are not changed. On .NET Framework, standard controls an application places inside one of them are styled while that control is in dark mode; on .NET 10 and later the dark mode of Windows Forms applies to them as to every standard control.
On .NET Framework, in an application that is per-monitor DPI aware, SftStyle also scales a form that opens on a monitor with a different scale factor than the one it was laid out for, and gives the controls that Windows Forms leaves with a small font after a form moves to such a monitor their rescaled font (see the SftStyle.Scaling event).
Every application that uses SftStyle/NET has an SftStyle component. It carries the license the Visual Studio designer saves with the form (Contents), which also licenses SftMessageBox, SftTaskDialog and the sliders and color dialogs created in code. A component created in code starts when its SftStyle.DarkMode or SftStyle.HighContrastMode property is set or, without that, at the application's first idle moment; an application that creates its SftStyle component in code therefore loads the license with SftStyle.SetContents right after it creates the component, before it sets a property.
Namespace: Softelvdm.SftStyleNET
Assembly: Softelvdm.SftStyleNET
Inheritance
public class SftStyle : System.ComponentModel.Component, System.ComponentModel.ISupportInitialize;
Public Class SftStyle
Inherits System.ComponentModel.Component
Implements System.ComponentModel.ISupportInitialize![]() | SftStyle | Initializes a new instance of the SftStyle class. |
![]() ![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. |
![]() ![]() | Container | Gets the IContainer that contains the Component. |
![]() | Contents | The license information, which the Visual Studio designer saves with the form. |
![]() | DarkMode | Defines whether the forms of the application use dark mode colors. |
![]() | DarkModeActive | Returns whether dark mode is in effect. |
![]() ![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. |
![]() ![]() | Events | Gets the list of event handlers that are attached to this Component. |
![]() | HighContrastActive | Returns whether high contrast is in effect. |
![]() | HighContrastMode | Defines whether the forms of the application use the colors of the Windows contrast theme. |
![]() ![]() | Site | Gets or sets the ISite of the Component. |
![]() ![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. |
![]() | Dispose | Releases the resources used by the component. |
![]() ![]() | Equals | Determines whether the specified object is equal to the current object. |
![]() ![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. |
![]() ![]() | GetContents | Returns the license information of a component as an XML document. |
![]() ![]() | GetHashCode | Serves as the default hash function. |
![]() ![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. |
![]() ![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. |
![]() ![]() | GetType | Gets the Type of the current instance. |
![]() ![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. |
![]() ![]() ![]() | ReferenceEquals | Determines whether the specified Object instances are the same instance. |
![]() ![]() | SetContents | Loads the license information of a component from an XML document. |
![]() ![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. |
![]() | DarkModeChanged | Occurs when the SftStyle.DarkModeActive property changes. |
![]() ![]() | Disposed | Occurs when the component is disposed by a call to the Dispose method. |
![]() | HighContrastChanged | Occurs when the SftStyle.HighContrastActive property changes. |
![]() | Scaling | Occurs before a form or a control is scaled for the DPI of its monitor. |
![]() | Styling | Occurs before a control is styled. |
See Also Classes | SftStyle/NET 3.0