HeaderPane
Main
Hide
Share Link
Print

SftStyle Class

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

Syntax

public class SftStyle : System.ComponentModel.Component,
    System.ComponentModel.ISupportInitialize;
Public Class SftStyle
    Inherits System.ComponentModel.Component
    Implements System.ComponentModel.ISupportInitialize

Constructors

PublicSftStyleInitializes a new instance of the SftStyle class.

Properties

ProtectedInherited from System.ComponentModel.ComponentCanRaiseEventsGets a value indicating whether the component can raise an event.
PublicInherited from System.ComponentModel.ComponentContainerGets the IContainer that contains the Component.
PublicContentsThe license information, which the Visual Studio designer saves with the form.
PublicDarkModeDefines whether the forms of the application use dark mode colors.
PublicDarkModeActiveReturns whether dark mode is in effect.
ProtectedInherited from System.ComponentModel.ComponentDesignModeGets a value that indicates whether the Component is currently in design mode.
ProtectedInherited from System.ComponentModel.ComponentEventsGets the list of event handlers that are attached to this Component.
PublicHighContrastActiveReturns whether high contrast is in effect.
PublicHighContrastModeDefines whether the forms of the application use the colors of the Windows contrast theme.
PublicInherited from System.ComponentModel.ComponentSiteGets or sets the ISite of the Component.

Methods

PublicInherited from System.MarshalByRefObjectCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
PublicDisposeReleases the resources used by the component.
PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ComponentModel.ComponentFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.
PublicStaticGetContentsReturns the license information of a component as an XML document.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.MarshalByRefObjectGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance.
ProtectedInherited from System.ComponentModel.ComponentGetServiceReturns an object that represents a service provided by the Component or by its Container.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
PublicInherited from System.MarshalByRefObjectInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicStaticSetContentsLoads the license information of a component from an XML document.
PublicInherited from System.ComponentModel.ComponentToStringReturns a String containing the name of the Component, if any. This method should not be overridden.

Events

PublicDarkModeChangedOccurs when the SftStyle.DarkModeActive property changes.
PublicInherited from System.ComponentModel.ComponentDisposedOccurs when the component is disposed by a call to the Dispose method.
PublicHighContrastChangedOccurs when the SftStyle.HighContrastActive property changes.
PublicScalingOccurs before a form or a control is scaled for the DPI of its monitor.
PublicStylingOccurs before a control is styled.

See Also Classes | SftStyle/NET 3.0