HeaderPane
Main
Hide

SftTree/DLL 8.0 - Tree Control

Share Link
Print

High Contrast

Windows High Contrast 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. SftTree/DLL 8.0 follows this rule automatically.

When Windows High Contrast is active, the tree control:

  • renders backgrounds in COLOR_WINDOW, text in COLOR_WINDOWTEXT, selection in COLOR_HIGHLIGHT / COLOR_HIGHLIGHTTEXT, grid lines in COLOR_BTNSHADOW, and similar for other roles,
  • ignores caller-supplied color overrides (SetCtlColors, per-column colors, permanent background, odd-row colors) on the default render path - the user's contrast theme wins,
  • suppresses Windows themes. Column headers, column footers and row headers fall back to a non-themed GDI path that honors system colors directly.

The tree control's high contrast setting has three values (see SetHighContrastMode):

AUTO (default)Follow the Windows High Contrast setting. The control re-renders when the setting flips.
ONAlways use the system palette, regardless of the Windows High Contrast setting. Useful for testing or for applications that want consistent high-contrast rendering for a specific tree.
OFFIgnore the Windows High Contrast setting and render normally. Not recommended in shipping applications - it means users with accessibility needs will see rendering that does not comply with their contrast theme.

SFTTREEN_HIGHCONTRAST_CHANGED is sent to the parent window each time the active state flips (AUTO mode only) so the application can repaint its own chrome to match. IsHighContrastActive reports the current state at any time.

Owner-draw code is responsible for its own high-contrast compliance. Every SFTTREE_OWNERDRAW callback receives a fHighContrast field; owner-draw code should inspect it on each paint and re-map role colors to the matching system color instead of using the application's normal palette. Failing to do this makes owner-drawn cells unreadable under a user's high-contrast theme.

Dark mode and Windows High Contrast are independent. If the user has both enabled, 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.