HeaderPane
Main
Hide
Share Link
Print

DarkModeActive Property, SftStyle Class

Returns whether dark mode is in effect.

Class: SftStyle
Namespace: Softelvdm.SftStyleNET
Assembly: Softelvdm.SftStyleNET

Syntax

public bool DarkModeActive { get; }
Public ReadOnly Property DarkModeActive As Boolean

Value

True if dark mode is in effect from SftStyle.DarkMode and, with DarkModeEnum.Auto, the Windows setting, False otherwise. While SftStyle.HighContrastActive is True the forms are not styled in dark mode, even if this property is True.

Comments

Returns whether dark mode is in effect.

Examples

C# View entire sample code

        }

        private void sftStyle1_HighContrastChanged(object sender, EventArgs e) {
            ShowState();
        }

        // With Auto, the component follows the Windows settings, also when they change while the form is open.
        private void ShowState() {
            labelState.Text = "Dark mode is " + (sftStyle1.DarkModeActive ? "on" : "off") + ", high contrast is " + (sftStyle1.HighContrastActive ? "on" : "off") + ".";
        }

        private void sliderVolume_ValueChanged(object sender, EventArgs e) {
            ShowSliders();
        }

        private void sliderPrice_RangeChanged(object sender, EventArgs e) {

VB.NET View entire sample code

    End Sub

    Private Sub SftStyle1_HighContrastChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SftStyle1.HighContrastChanged
        ShowState()
    End Sub

    ' With Auto, the component follows the Windows settings, also when they change while the form is open.
    Private Sub ShowState()
        LabelState.Text = "Dark mode is " + If(SftStyle1.DarkModeActive, "on", "off") + ", high contrast is " + If(SftStyle1.HighContrastActive, "on", "off") + "."
    End Sub

    Private Sub SliderVolume_ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SliderVolume.ValueChanged
        ShowSliders()
    End Sub

    Private Sub SliderPrice_RangeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles SliderPrice.RangeChanged

See Also SftStyle Class | Classes | SftStyle/NET 3.0