My question is about combo boxes in Windows MFC applications.
The dropdown part of the combo box contains items composed of a bitmap and a string.
Sometimes, the strings are too long and I have to adjust the width of the dropdown part of the combo box using the CComboBox::SetDroppedWidth()
method.
My problem is that when the combo box is near the right edge of the computer screen, the right part of the dropdown is hidden (see image_1
and image_2
below).
I would like it to behave like in Excel (see image_3
below) meaning I would like the dropdown list to be shifted accordingly so that all its items can be seen without being cropped.
How can this be achieved?
image_1: right part of the dropdown is NOT hidden
image_2: near the computer right edge, the right part of the dropdown is hidden
=================================================================
=================================================================
EDIT 2
Ok. I forgot to mention that m_cbXmodels
is a CComboBoxEx
object. This is why the handles are NULL. I could get the handles via GetComboBoxCtrl()
...