HeaderPane
Main
Hide

SftTree/DLL 8.0 - Tree Control

Share Link
Print

HighContrastMode

Defines whether the tree control honors the Windows High Contrast accessibility setting.

C

void WINAPI SftTree_SetHighContrastMode(HWND hwndCtl, int mode);
int WINAPI SftTree_GetHighContrastMode(HWND hwndCtl);
BOOL WINAPI SftTree_IsHighContrastActive(HWND hwndCtl);
void WINAPI SftTreeSplit_SetHighContrastMode(HWND hwndCtl, int mode);
int WINAPI SftTreeSplit_GetHighContrastMode(HWND hwndCtl);
BOOL WINAPI SftTreeSplit_IsHighContrastActive(HWND hwndCtl);

C++

void CSftTree::SetHighContrastMode(int mode);
int CSftTree::GetHighContrastMode() const;
BOOL CSftTree::IsHighContrastActive() const;
void CSftTreeSplit::SetHighContrastMode(int mode);
int CSftTreeSplit::GetHighContrastMode() const;
BOOL CSftTreeSplit::IsHighContrastActive() const;

Parameters

hwndCtl

The window handle of the tree control.

mode

Defines the high contrast mode setting. mode can be one of the following values:

SFTTREE_HIGHCONTRAST_OFFThe tree control ignores the Windows High Contrast setting and renders normally, using the tree control's configured colors and themes.
SFTTREE_HIGHCONTRAST_ONThe tree control always renders using the Windows system color palette (COLOR_WINDOW, COLOR_WINDOWTEXT, COLOR_HIGHLIGHT, etc.) as if Windows High Contrast were active.
SFTTREE_HIGHCONTRAST_AUTOThe tree control follows the current Windows High Contrast accessibility setting and switches automatically when the user changes it. This is the default.

Returns

GetHighContrastMode returns a value indicating the current high contrast mode setting (SFTTREE_HIGHCONTRAST_OFF, SFTTREE_HIGHCONTRAST_ON or SFTTREE_HIGHCONTRAST_AUTO).

IsHighContrastActive returns TRUE if high contrast rendering is currently in effect on the tree control, otherwise FALSE. When mode is SFTTREE_HIGHCONTRAST_AUTO, the return value reflects the current Windows accessibility setting.

Comments

The SetHighContrastMode, GetHighContrastMode and IsHighContrastActive functions define and retrieve a tree control's high contrast mode setting. The default is SFTTREE_HIGHCONTRAST_AUTO so accessibility compliance is automatic; applications can opt out with SFTTREE_HIGHCONTRAST_OFF when a fully custom visual design is required.

When high contrast rendering is active, caller-supplied color overrides set with SetCtlColors, per-column colors, permanent background color, selection colors, grid line colors and odd-row colors are ignored on the default render path. The control instead uses the matching Windows system color (COLOR_WINDOW for backgrounds, COLOR_WINDOWTEXT for text, COLOR_HIGHLIGHT / COLOR_HIGHLIGHTTEXT for selection, COLOR_BTNSHADOW for grid lines, etc.), complying with Microsoft's High Contrast guidance that the user's chosen contrast theme must not be overridden by the application.

Windows themes are also suppressed in high contrast mode - fThemed is FALSE on both SFTTREE_OWNERDRAW callbacks and in internal header / footer rendering, so paint falls back to the non-themed GDI path that honors system colors.

When mode is SFTTREE_HIGHCONTRAST_AUTO, the tree control tracks WM_SETTINGCHANGE / SPI_SETHIGHCONTRAST notifications from Windows and re-renders automatically when the user toggles the accessibility setting. A SFTTREEN_HIGHCONTRAST_CHANGED notification is sent to the parent window each time the active state flips so the application can repaint other UI to match.

Owner-draw callbacks receive the current state in SFTTREE_OWNERDRAW's fHighContrast field. The strict color remap described above applies only to the default render path; owner-draw code is responsible for its own high contrast compliance.

See Also C/C++ API | Categories | Notifications