-
January 23rd, 2007, 01:51 PM
#1
HSCROLL in CComboBox dropdown
using MFC I have a CCombBox whose strings are longer than the dropdown is wide. I can not use owner draw because eVC++ 3.0 or VC++ 2005 for smart devices does not support it. Tried autohscroll but that is for the edit control, not the dropdown. Any ideas?
Thanks
-
January 23rd, 2007, 04:16 PM
#2
Re: HSCROLL in CComboBox dropdown
CComboBox::SetDroppedWidth
-
January 23rd, 2007, 05:26 PM
#3
Re: HSCROLL in CComboBox dropdown
Thanks for the suggestion. What I failed to mention is that I would like to have a horizontal scroll bar. The screens on wireless devices are only about two inches wide.
-
January 25th, 2007, 01:34 AM
#4
Re: HSCROLL in CComboBox dropdown
Try this:
Code:
COMBOBOXINFO stComboBoxInfo;
stComboBoxInfo.cbSize = sizeof(stComboBoxInfo);
m_oCombo.GetComboBoxInfo(&stComboBoxInfo);
CListBox oListBox;
oListBox.Attach(stComboBoxInfo.hwndList);
oListBox.ModifyStyle(0,WS_HSCROLL);
oListBox.SetHorizontalExtent(300);
oListBox.Detach();
Idea is to add the WS_HSCROLL style to the drop down list box and then also, set the horizontal extent ( MSDN documentation is kind of vague on this, but I guess , if say your listbox width is 200 pixels and your longest text extends upto 300 pixels, you use 300 for the SetHorizontalExtent ). Anyways, upto you to playaround and see if that works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|