Click here to Skip to main content
15,868,102 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everyone!

How can I change the size of the dropdown of a combobox to be dynamic in size from fixed width? I cannot find an event or a property that allows me to flip a switch. Am I missing something?

Thanks!
Posted

Of course you have such event:
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.resize.aspx[^].

But you don't need to use it. Instead, you should better use fluid layout of the whole form, using a hierarchy nested panels and docking (see System.Windows.Forms.Control.Dock), with System.Windows.Forms.Control.Padding. Please see my past answers:
Zom Out malfunctions when Screen resolution changes[^],
how to dock button so that it can adjust with the form[^] (see a tiny code sample here).

—SA
 
Share this answer
 
Comments
Espen Harlinn 17-Jan-13 16:26pm    
5'ed!
Sergey Alexandrovich Kryukov 17-Jan-13 16:42pm    
Thank you, Espen.
—SA
Yes you can change the width of the dropdown porting using the DropDownWidth property of ComboBox

Check this ComboBox.DropDownWidth Property[^]

but you need to set the new size of your choice. it wont expand/shrink automatically
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900