如何在组合框中设置建议列表的宽度

如何在组合框中设置建议列表的宽度

本文介绍了如何在组合框中设置建议列表的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用带有.net4 c#的组合框,我需要动态设置下拉列表的宽度.字符串列表是在运行时从SQL查询添加的.

组合框设置为以下内容:
AutoCompleteMode:SuggestAppend
AutoCompleteSource:ListItems
DropDownStyle:Simple

这会在您键入时提供匹配项列表,但是必须手动调整长字符串的宽度.

我在这里 [ ^ ],并且在 DropDownStyle:DropDown 时适用于下拉列表,但是如果键入一些文本,则指出的问题仍然很明显.

谁能指出我的解决方案?

Hi
I''m using a combo box with .net4 c# and I need to set the width of the drop down list dynamically. The list of stings are added from a SQL query at run time.

The combo box is set to the following:
AutoCompleteMode:SuggestAppend
AutoCompleteSource:ListItems
DropDownStyle:Simple

This gives a list of matches while you type, but the width has to be manually adjusted for long strings.

I have used the suggested code in here Adjust combo box drop down list width to longest string width[^] and that works for the drop down list when DropDownStyle:DropDown, but if you type in some text, the problem noted is still apparent.

Can anyone point me to a solution?

推荐答案


这篇关于如何在组合框中设置建议列表的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:17