HeaderPane
Main
Hide
Share Link
Print

DarkMode Property, SoftelvdmUserControl Class

Defines whether the control uses dark mode colors.

Class: SoftelvdmUserControl
Namespace: Softelvdm.SftBoxNET.Controls
Assembly: Softelvdm.SftBoxNET

Syntax

public DarkModeEnum DarkMode { get; set; }
Public Property DarkMode As DarkModeEnum

Value

The dark mode setting.

The default value is DarkModeEnum.Off.

Comments

Defines whether the control uses dark mode colors.

In dark mode, colors that are left at their system defaults are replaced by their dark counterparts and themed elements such as headers, buttons and scrollbars use the dark Windows themes. Colors that are set explicitly are used as defined.

With DarkModeEnum.Auto, the control follows the Windows setting for app mode (Settings, Personalization, Colors) and switches when that setting changes. The DarkModeActive property returns the resulting state.

Examples

C# View entire sample code

                sftBox3.SelectedItem = sftBox3.Items[0];

            BindLookup();

            FillCombo(comboSearch, typeof(SearchModeEnum), sftBox5.SearchMode);
            FillCombo(comboAlignment, typeof(DropDownAlignmentEnum), sftBox1.DropDownAlignment);
            FillCombo(comboPosition, typeof(DropDownPositionEnum), sftBox1.DropDownPosition);
            FillCombo(comboNumbering, typeof(RowHeaderNumberingEnum), sftBox7.List.RowHeaders.Numbering);
            FillCombo(comboDarkMode, typeof(DarkModeEnum), sftBox1.DarkMode);
            FillCombo(comboHighContrast, typeof(HighContrastModeEnum), sftBox1.HighContrastMode);
            DpiChanged += Form1_DpiChanged;
        }

        // On the .NET Framework, a ComboBox in a container keeps its old font when the window moves to a monitor with
        // another scale. Setting another font and then the inherited one again makes it use the new one.
        private void Form1_DpiChanged(object sender, DpiChangedEventArgs e) {

VB.NET View entire sample code

        End If

        BindLookup()

        FillCombo(ComboSearch, GetType(SearchModeEnum), SftBox5.SearchMode)
        FillCombo(ComboAlignment, GetType(DropDownAlignmentEnum), SftBox1.DropDownAlignment)
        FillCombo(ComboPosition, GetType(DropDownPositionEnum), SftBox1.DropDownPosition)
        FillCombo(ComboNumbering, GetType(RowHeaderNumberingEnum), SftBox7.List.RowHeaders.Numbering)
        FillCombo(ComboDarkMode, GetType(DarkModeEnum), SftBox1.DarkMode)
        FillCombo(ComboHighContrast, GetType(HighContrastModeEnum), SftBox1.HighContrastMode)
    End Sub

    ' On the .NET Framework, a ComboBox in a container keeps its old font when the window moves to a monitor with
    ' another scale. Setting another font and then the inherited one again makes it use the new one.
    Private Sub Form1_DpiChanged(ByVal sender As Object, ByVal e As DpiChangedEventArgs) Handles Me.DpiChanged
        BeginInvoke(New MethodInvoker(Sub()

See Also SoftelvdmUserControl Class | Classes | SftBox/NET 3.0