将组合框下拉列表的宽度更改为动态大小? [英] Changing the width of a combobox dropdown to be dynamic in size?

查看:77
本文介绍了将组合框下拉列表的宽度更改为动态大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



如何将组合框下拉列表的大小从固定宽度更改为动态大小?我找不到允许我翻转开关的事件或属性。我错过了什么吗?



谢谢!

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!

推荐答案

当然你有这样的事件:

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 [ ^ ]。



但你不需要使用它。相反,您应该更好地使用整个表单的流体布局,使用层次结构嵌套面板和对接(请参阅 System.Windows.Forms.Control.Dock ), System.Windows.Forms.Control.Padding 。请查看我过去的答案:

屏幕分辨率更改时,Zom Out出现故障 [ ^ ],

如何停靠按钮,以便它可以调整表格 [ ^ ](见一个小小的)这里的代码示例。



-SA
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


是的,您可以更改下拉列表的宽度使用ComboBox的DropDownWidth属性移植



选中 ComboBox.DropDownWidth属性 [ ^ ]



但你需要设置你选择的新尺寸。它不会自动扩展/收缩
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


这篇关于将组合框下拉列表的宽度更改为动态大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆