SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Selects how the button control participates in Windows dark mode.
C
void SftButton_SetDarkMode(HWND hwndCtl, int mode);
C++
void CSftButton::SetDarkMode(int mode);
hwndCtl
The window handle of the button control.
mode
The dark mode setting. One of the following values:
| SFTBUTTON_DARKMODE_OFF | Always use the light palette, regardless of the Windows setting. This is the default. |
| SFTBUTTON_DARKMODE_ON | Always use the dark palette, regardless of the Windows setting. |
| SFTBUTTON_DARKMODE_AUTO | Follow the Windows "Choose your mode" setting. The control automatically re-renders when the Windows setting flips. |
SetDarkMode selects whether the button uses the dark or light color palette. The default is SFTBUTTON_DARKMODE_OFF, which keeps the button in the light palette regardless of the Windows setting - this preserves visual back-compatibility for applications written before dark mode existed. Applications that want to participate in dark mode should set SFTBUTTON_DARKMODE_AUTO to follow the Windows "Choose your mode" setting, or maintain their own Light / Dark toggle and switch each button to SFTBUTTON_DARKMODE_ON / OFF as the toggle changes.
When the mode is SFTBUTTON_DARKMODE_AUTO, the control sends SFTBUTTONN_DARKMODE_CHANGED to its parent window each time the active dark mode state flips so the application can repaint its own surrounding chrome.
Caller-supplied color overrides remain in effect in every mode - SetDarkMode does not override per-state background, gradient, text or border colors set by the application.
Dark mode requires Windows 10 or later. On earlier platforms the setting is stored but has no visual effect.
}
return TRUE;
case IDC_DARK_MODE:
if (HIWORD(wParam) == BN_CLICKED) {
BOOL fDark = IsDlgButtonChecked(hwndDlg, IDC_DARK_MODE) == BST_CHECKED;
int btnMode = fDark ? SFTBUTTON_DARKMODE_ON : SFTBUTTON_DARKMODE_OFF;
int ids[] = { IDC_SFTBUTTON1, IDC_SFTBUTTON2, IDC_SFTBUTTON3 };
for (int i = 0; i < (int)(sizeof(ids) / sizeof(ids[0])); ++i)
SftButton_SetDarkMode(GetDlgItem(hwndDlg, ids[i]), btnMode);
SftDarkMode_SetActive(fDark);
SftDarkMode_ApplyToDialog(hwndDlg);
InvalidateRect(hwndDlg, NULL, TRUE);
}
return TRUE;
}
break;See Also GetDarkMode | IsDarkModeActive | SetHighContrastMode | Dark Mode | High Contrast | Notifications
