如何通过多次按键选择特定的组合框项目? 项目的前几个字符
XP 中的 Windows 资源管理器将允许您通过键入几个字符来选择文件。 我想知道是否有任何简单的 .net 功能可以用来在组合框中模仿这种行为? 我认为我以前在组合框中见过这种情况,并且想知道是否有我可以使用的属性?
我知道我可以围绕“关键”事件开发代码,但无法证明花时间在上面是合理的。
例如:在包含“Apple.doc、banana.doc、cherry.doc、cranberry.doc”的文件夹中,键入“b”将选择“banana.doc”,键入“c”将选择“cherry.doc”,但输入“cr”将选择“cranberry.doc”
提前致谢 G
Windows explorer in XP will allow you to make a file selection based on typing a few characters. I would like to know if there is any simplistic .net feature I can use to mimic this behaviour in a combobox? I think I've seen this happen in comboboxes before, and would like to know if there is a property I can use?
I know I could develop code around the "Key" events, but can't justify spending the time on it.
For example: In a folder which contains "Apple.doc, banana.doc, cherry.doc, cranberry.doc" then typing "b" will select "banana.doc", typing "c" will select "cherry.doc" but typing "cr" will select "cranberry.doc"
Thanks in advance
G
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看看 ComboBox.AutoCompleteMode。
Have a look at ComboBox.AutoCompleteMode.
感谢丹尼尔的上述回答。
我还想向其他有类似查询的人指出 AutoCompleteMode 解释了每个 AutoCompleteMode 值的详细信息。
总结一下:
无 - 禁用 ComboBox 和 TextBox 控件的自动完成功能。
建议 - 显示与编辑控件关联的辅助下拉列表。 此下拉列表中填充了一个或多个建议的完成字符串。
附加 - 将最可能的候选字符串的其余部分附加到现有字符,突出显示附加的字符。
SuggestAppend - 应用建议和附加选项。
Thanks to Daniel for the above answer.
I would also like to point others with a similar queries to AutoCompleteMode which explains the details of each AutoCompleteMode value.
In summary:
None - Disables the automatic completion feature for the ComboBox and TextBox controls.
Suggest - Displays the auxiliary drop-down list associated with the edit control. This drop-down is populated with one or more suggested completion strings.
Append - Appends the remainder of the most likely candidate string to the existing characters, highlighting the appended characters.
SuggestAppend - Applies both Suggest and Append options.