在的WinForms文本框的自动完成下拉框中的获取手柄 [英] Getting handle of Autocomplete dropdown box of textbox in winforms

查看:171
本文介绍了在的WinForms文本框的自动完成下拉框中的获取手柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要调整文本框的自动完成下拉框的宽度。我不想来调整文本框的宽度,但只有自动完成下拉列表。我知道,有没有办法,我可以通过使用带有文本的属性增加自动完成下拉列表的宽度。

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.

因此​​,我想知道是否有办法让自动完成框的句柄,然后增加下降downlist的宽度不改变文本框的宽度?

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文本框的自动完成下拉框中的获取手柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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