Probably the combobox is not designed and is not suitable for multiple selections. Consider an alternative: CCheckListBox.
MFC- How to support multiselect in MFC Combobox?
abc abc
351
Reputation points
Hi,
MFC- How to support multiselect in MFC Combobox?
Thanks
Developer technologies | C++
3,977 questions
4 answers
Sort by: Most helpful
-
-
RLWA32 49,636 Reputation points
2021-12-17T11:24:20.703+00:00 This is one approach - https://www.codeproject.com/Articles/58/CheckComboBox-Control
-
Petrus 【KIM】 546 Reputation points
2021-12-20T00:48:15.677+00:00 -
Minxin Yu 13,506 Reputation points Microsoft External Staff
2021-12-20T03:07:05.257+00:00 Hi, @abc abc
You could try to create CCheckListBox by CListBox:
- Drag List Box to the Dialog and modify Has Strings and Owner Draw in properties:
- Add
CCheckListBox m_CheckListBox;
in dialog's .h file. - Add snippet below in dialog's OnInitDialog() function m_CheckListBox.SubclassDlgItem(IDC_LIST1, this);
m_CheckListBox.SetCheckStyle(BS_AUTOCHECKBOX);
m_CheckListBox.AddString(L"Test String");
m_CheckListBox.AddString(L"Test String");
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. - Drag List Box to the Dialog and modify Has Strings and Owner Draw in properties: