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. SftDate/OCX 2.0 supports this with the HighContrastMode property (HighContrastMode, HighContrastMode).
While high contrast is active, the controls:
The HighContrastMode property has three values (see SftDateHighContrastConstants):
| highContrastSftDateOff (default) | Ignore the Windows High Contrast setting and render normally, using the colors defined by the application. Not recommended for applications which define their own colors - users with accessibility needs will see rendering that does not comply with their contrast theme. |
| highContrastSftDateOn | Always use the system colors, regardless of the Windows High Contrast setting. Useful for testing. |
| highContrastSftDateAuto | Follow the Windows High Contrast setting. The control redraws when the setting changes and raises the HighContrastChange event. |
The default is highContrastSftDateOff. An application should set the HighContrastMode property to highContrastSftDateAuto, at design time or once when the form is loaded:
sftDate1.HighContrastMode = SftDateHighContrastConstants.highContrastSftDateAuto; sftCalendar1.HighContrastMode = SftDateHighContrastConstants.highContrastSftDateAuto;
The HighContrastActive property (HighContrastActive, HighContrastActive) reports whether high contrast rendering is currently in effect.
The HighContrastChange event (HighContrastChange, HighContrastChange) occurs each time the active state changes because of the Windows setting (highContrastSftDateAuto only), so the application can repaint its own user interface to match. Its Active parameter (e.active in .NET) is the new state.
Pictures, such as the pictures of special dates, are drawn as defined. Make sure that the pictures used in the calendar remain visible with the user's contrast theme colors.
With highContrastSftDateAuto, the control follows the Windows setting on its own, in any container: turning a contrast theme on or off changes the Windows theme, and Windows sends the WM_THEMECHANGED message to every window, the controls included. The application does not need to pass any message on.
Dark mode and Windows High Contrast are independent. If both are active, high contrast takes precedence - the contrast theme's palette wins over the dark palette, because honoring the user's contrast theme is the stronger accessibility requirement (see Dark Mode).