HeaderPane
Main
Hide
Share Link
Print

SelectionStyle

Defines the display style of the selected item.

C

int WINAPI SftBox_GetSelectionStyle(HWND hwndCtl);
void WINAPI SftBox_SetSelectionStyle(HWND hwndCtl, int style);

C++

int CSftBox::GetSelectionStyle() const;
void CSftBox::SetSelectionStyle(int style);

Parameters

hwndCtl

The window handle of the combo box control.

style

Defines the display style used for the selected item. style can be one of the following values:

SFTBOX_SELECTION_ALLHighlights the entire item, including all cells, the label picture and item picture. When using the 3D display mode (enabled using SetShow3D), SFTBOX_SELECTION_ALL is equivalent to SFTBOX_SELECTION_CELLS.
SFTBOX_SELECTION_CELLSHighlights cells only.
SFTBOX_SELECTION_CELL1Highlights the text in the first cell only.
SFTBOX_SELECTION_CELLCURRENTHighlights the entire current cell only. The current cell is always the cell in the first displayed column of the selected item.
SFTBOX_SELECTION_CELL1FULLHighlights the text in the first cell only. Identical to SFTBOX_SELECTION_CELL1, but the text background color of the selected item extends to the top and bottom of the cell.
The value of an entry in the above table can be combined with the following value and passed as style parameter:
SFTBOX_SELECTION_OUTLINEThe selected display style from the above table is rendered using a rounded outline rectangle with a gradient fill. The outline colors and gradient fill are defined using the members of the SFTBOX_COLORS structure. GDI+ support is required (see GetGDIPlusAvailable), otherwise SFTBOX_SELECTION_OUTLINE is ignored.

Returns

GetSelectionStyle returns a value indicating the current display style of the selected item.

Comments

The GetSelectionStyle and SetSelectionStyle functions define the display style of the selected item.

The selection style is used for the selected item in the dropdown portion and for the item shown in the static portion. By default, SFTBOX_SELECTION_ALL is used. If an invalid style is specified, the current setting is not changed.

The selection style affects the visual representation of the selected item only. SftBox/DLL supports item selection only. Cell selection as typically found in a grid control is not supported.

Examples

C View entire sample code

}

static void InitControls(void)
{
    SFTBOX_COLUMN aCols[2];
    SFTBOX_DELETEPARM Parm;

    // FONT NAMES combo box
    SftBox_SetSelectionStyle(m_hwndFonts, SFTBOX_SELECTION_CELL1);
    SftBox_SetDroppedHeight(m_hwndFonts, 8);
    SftBox_SetShowHeader(m_hwndFonts, SFTBOX_COLSTYLE_BUTTONTEXT);
    SftBox_EnableSortIndicators(m_hwndFonts, TRUE, FALSE);// the application sets the sort indicators
    SftBox_SetDarkMode(m_hwndFonts, SFTBOX_DARKMODE_AUTO);

    InitColumn(&aCols[0], 0, 174, TEXT("Font Name"));
    InitColumn(&aCols[1], 1, 400, TEXT("Sample"));

C++ View entire sample code

// Combo box setup

void CMainDlg::InitControls()
{
    SFTBOX_COLUMN aCols[2];
    SFTBOX_DELETEPARM Parm;

    // FONT NAMES combo box
    m_Fonts.SetSelectionStyle(SFTBOX_SELECTION_CELL1);
    m_Fonts.SetDroppedHeight(8);
    m_Fonts.SetShowHeader(SFTBOX_COLSTYLE_BUTTONTEXT);
    m_Fonts.EnableSortIndicators(TRUE, FALSE);// the application sets the sort indicators
    m_Fonts.SetDarkMode(SFTBOX_DARKMODE_AUTO);

    InitColumn(&aCols[0], 0, 174, _T("Font Name"));
    InitColumn(&aCols[1], 1, 400, _T("Sample"));

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


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