HeaderPane
Main
Hide
Share Link
Print

HighContrastMode Property, SoftelvdmUserControl Class

Defines whether the control uses the colors of the Windows contrast theme.

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

Syntax

public HighContrastModeEnum HighContrastMode { get; set; }
Public Property HighContrastMode As HighContrastModeEnum

Value

The high contrast setting.

The default value is HighContrastModeEnum.Off.

Comments

Defines whether the control uses the colors of the Windows contrast theme.

In high contrast mode, the control draws all its elements using the system colors of the user's contrast theme. Colors defined by the application for the control, its columns, items, cells and parts are ignored, and headers, footers, row headers and buttons are drawn without Windows themes.

With HighContrastModeEnum.Auto, the control follows the Windows contrast theme setting (Settings, Accessibility, Contrast themes) and switches when that setting changes. The HighContrastActive property returns the resulting state.

High contrast mode takes precedence over dark mode.

Examples

C# View entire sample code

            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) {
            BeginInvoke(new MethodInvoker(delegate {
                foreach (Control c in groupOptions.Controls) {

VB.NET View entire sample code

        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()
                                          For Each c As Control In GroupOptions.Controls
                                              If Not TypeOf c Is ComboBox Then Continue For

See Also SoftelvdmUserControl Class | Classes | SftBox/NET 3.0