HeaderPane
Main
Hide
Share Link
Print

DarkMode

Defines whether the combo box control is rendered using a dark color palette.

C

void WINAPI SftBox_SetDarkMode(HWND hwndCtl, int mode);
int WINAPI SftBox_GetDarkMode(HWND hwndCtl);
BOOL WINAPI SftBox_IsDarkModeActive(HWND hwndCtl);

C++

void CSftBox::SetDarkMode(int mode);
int CSftBox::GetDarkMode() const;
BOOL CSftBox::IsDarkModeActive() const;

Parameters

hwndCtl

The window handle of the combo box control.

mode

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

SFTBOX_DARKMODE_OFFThe combo box control is always rendered using the light color palette. This is the default.
SFTBOX_DARKMODE_ONThe combo box control is always rendered using the dark color palette, regardless of the Windows system setting.
SFTBOX_DARKMODE_AUTOThe combo box control follows the current Windows "Choose your mode" setting (Light / Dark) and switches automatically when the user changes the system setting.

Returns

GetDarkMode returns a value indicating the current dark mode setting (SFTBOX_DARKMODE_OFF, SFTBOX_DARKMODE_ON or SFTBOX_DARKMODE_AUTO).

IsDarkModeActive returns TRUE if dark mode is currently in effect, otherwise FALSE. When the dark mode setting is SFTBOX_DARKMODE_AUTO, the return value reflects the current Windows system setting. The return value is not affected by high contrast mode.

Comments

The SetDarkMode, GetDarkMode and IsDarkModeActive functions define and retrieve a combo box control's dark mode setting.

Dark mode applies to all portions of the combo box control (static portion, edit control portion, dropdown portion and dropdown button).

When mode is SFTBOX_DARKMODE_AUTO, the combo box control re-renders automatically when the user toggles the Windows system Light / Dark setting. A SFTBOXN_DARKMODE_CHANGED notification is sent to the parent window each time the active mode changes because of the system setting, so the application can repaint other UI to match. The combo box control learns about the change of the system setting through the WM_SETTINGCHANGE message, which the parent window must forward to the combo box (see Dark Mode).

If mode is not one of the values listed above, SetDarkMode has no effect.

High contrast mode takes precedence over dark mode (see SetHighContrastMode).

The dark mode setting is also available as the nDarkMode member of the SFTBOX_CONTROL structure, the current state as its fDarkModeActive member (see GetControlInfo).

Examples

C View entire sample code

    InitColumn(&aCols[0], 0, 100, TEXT("Color"));
    InitColumn(&aCols[1], 1, 100, TEXT("Description"));
    SftBox_SetColumns(hwndBox, 2, aCols);
    SftBox_SetShowHeaderDropDown(hwndBox, TRUE);// Column titles in the dropdown only
    SftBox_SetDroppedHeight(hwndBox, 12);       // Show up to 12 items
    SftBox_SetDropDownOptimalWidth(hwndBox, TRUE);// The dropdown is as wide as its columns
    SftBox_SetDisableNoScroll(hwndBox, TRUE);   // Scroll bars always shown, needed for the sizing box
    SftBox_SetShowResizer(hwndBox, TRUE);       // The user can resize the dropdown
    SftBox_SetDarkMode(hwndBox, SFTBOX_DARKMODE_AUTO);

    // Register the size of the cell pictures before adding items.
    // All pictures in the cells of a control are the same size.
    {
        SFTBOX_CELLINFOPARM CellInfo;
        memset(&CellInfo, 0, sizeof(CellInfo));
        CellInfo.index = -1;

C++ View entire sample code

    InitColumn(&aCols[0], 0, 100, _T("Color"));
    InitColumn(&aCols[1], 1, 100, _T("Description"));
    box.SetColumns(2, aCols);
    box.SetShowHeaderDropDown(TRUE);    // Column titles in the dropdown only
    box.SetDroppedHeight(12);           // Show up to 12 items
    box.SetDropDownOptimalWidth(TRUE);  // The dropdown is as wide as its columns
    box.SetDisableNoScroll(TRUE);       // Scroll bars always shown, needed for the sizing box
    box.SetShowResizer(TRUE);           // The user can resize the dropdown
    box.SetDarkMode(SFTBOX_DARKMODE_AUTO);

    // Register the size of the cell pictures before adding items.
    // All pictures in the cells of a control are the same size.
    {
        SFTBOX_CELLINFOPARM CellInfo;
        memset(&CellInfo, 0, sizeof(CellInfo));
        CellInfo.index = -1;

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


Last Updated 11/21/2026 - (email)
© 2026 Softel vdm, Inc.