我想调整文本框的自动完成下拉框的宽度.我不想调整该文本框的宽度,而只想调整自动完成下拉菜单.我知道我无法通过使用文本框提供的属性来增加自动完成下拉菜单的宽度.
I wanted to adjust the width of the Autocomplete dropdown box of a textbox. I dont want to adjust the width of that textbox, but only Autocomplete dropdown. I know that there is no way I can increase the width of the Autocomplete dropdown by using properties provided with textbox.
因此我想知道是否有任何方法可以获取该自动完成框的句柄,然后在不更改文本框宽度的情况下增加该下拉列表的宽度?
Hence I wanted to know whether there is any way to get the handle of that Autocomplete box and then increase the width of that drop downlist without changing the textbox width?
如果这不可能,那么我想创建带有自动完成功能的自定义文本框,在这种情况下,如何使用微软提供的现有自动完成功能?有没有办法做到这一点.有没有可用的库?
If this is not possible then I would like to create my custom textbox with autocomplete, in this case how to use the existing autocomplete functionality provided by microsoft? Is there any way to do it. Are there any libraries available for this?
在浏览了很多博客文章和不同的文章后,我达成了一个共识,即几乎不可能以我的方式解决我的问题通缉.所以我决定要么想出一个自定义的解决方案,要么像盛江所说的那样,我需要实现我自己的自动完成对象.
After going through lot of blog posts and different articles, I came to a consensus that it is next to impossible to get a solution to my problem in the way I wanted. So I've decided either to come up with a custom solution or as Sheng Jiang said I need to implement my own autocomplete object.
我想出了一个符合我要求的解决方案,方法是在我添加自动完成自定义源时根据自动完成字符串列表中的最大字符串增加文本框的宽度.正如我所说,由于表单的大小限制,我无法增加文本框的宽度,所以我决定将此文本框保留在面板中并增加其中文本框的大小.面板不会随文本框一起增长,从而解决了我的问题.
I've come up with a solution which fits my requirement by increasing the width of the textbox as per the largest string in the autocomplete string list while I'm adding the autocomplete custom source. As I said I cant increase the width of the text box because of the size constraint on the form, so I decided to keep this textbox in a panel and increase the size of the textbox inside that. Panel will not grow with the textbox so that solved my problem.
我知道这不是完美的解决方案,但它符合我的要求.
I know this is not perfect solution but it fits my requirement.
这篇关于获取winforms中文本框自动完成下拉框的句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!