HeaderPane
Main
Hide
Share Link
Print

High Contrast

Windows High Contrast (contrast themes) is an accessibility setting, not a visual preference. Users who enable it have committed to a specific high-contrast color scheme for everything on screen, and Microsoft's accessibility guidelines require applications to let the user's scheme win over any application-chosen colors. SftMask/NET 3.0 follows this rule when high contrast mode is active.

When high contrast mode is active, the control:

  • uses the system colors of the user's contrast theme for all its elements, such as SystemColors.Window and SystemColors.WindowText for the field and SystemColors.Highlight for the selection,
  • ignores colors set by the application for the control and the calculator, the invalid colors included - the user's contrast theme wins,
  • draws its border and buttons without Windows themes.

The SftMask.HighContrastMode property has three values (see HighContrastModeEnum):

ValueDescription
HighContrastModeEnum.AutoFollow the Windows contrast theme setting. The control switches when the setting changes.
HighContrastModeEnum.OnAlways use the system colors, regardless of the Windows setting. Useful for testing.
HighContrastModeEnum.Off (default)Ignore the Windows contrast theme setting and draw normally. Not recommended in shipping applications - users with accessibility needs will see colors that do not follow their contrast theme.

The SftMask.HighContrastChanged event occurs each time the control switches between its own colors and the colors of the contrast theme, so the application can update its own colors around the control. The SftMask.HighContrastActive property returns the current state at any time.

Because the invalid colors are not shown in high contrast mode, an application that relies on them to report invalid contents should also report them in another way, such as with the SftMask.ValidationError event (see Validation).

Dark mode and Windows High Contrast are independent settings. If both are active, high contrast takes precedence, because honoring the user's contrast theme is the stronger accessibility requirement. See Dark Mode.