Work with .net Combo Boxes

I have a form that has a Combo Box Control. I chose the drop down property for DropDown. I also set DropDown Width to 250. I set automatic full mode to offer, and auto-complete source for listitems. It works absolutely fine when I click on the dropdown menu. but when I enter something, the automatic mode completes the dropdown at the bottom, which has a small width.

any help appreciated. I want to know how to increase the width of automatic full dropdown using code so that the list items are viewed correctly. I am using c #

+6
c # combobox
source share
3 answers

Yes, this is by design. ComboBox uses the SHAutoComplete API function to implement the autocomplete function. Pay attention to the declaration, the function accepts the handle to the part of the ComboBox text field. Thus, he does not know that he is actually providing autocomplete information for ComboBox instead of TextBox. Accordingly, there is nothing that could be done to compensate for the non-standard width of the drop-down list that you are using.

Well, that explains why this doesn't work. Fixing is technically possible, but rather ugly. You will need to run the code in the KeyUp event and use EnumTheadWindows () to find the autocomplete window handle. Then you can use SetWindowPos () to make it larger. ComboBox.cs (AutoCompleteDropDownFinder.FindDropDowns) already has code similar to this, use Reference Source or Reflector to help you with this. Good luck

+4
source share

EDIT:
I deleted my first sentence to come up with a new link:

In fact, it can control the width of the Autocomplete drop-down list, but it is a little complicated and involves the wide use of the win API ...

The combo box is too small when you offer

+2
source share

Perhaps this article I wrote in Codeproject can help you regarding dropdowns and the way I hacked this ...

-one
source share

All Articles