组合或下拉框,用户可以输入自己的值吗? [英] Combo or drop-down box where user can enter own value as well?

查看:271
本文介绍了组合或下拉框,用户可以输入自己的值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以有一个组合框或下拉框,用户可以从给定的替代品列表中选择,或输入自己的值?

Can you have a combo or drop-down box where the user can either choose from a list of given alternatives, or enter their own value?

推荐答案

是的,这是标准 ComboBox 控件的一个功能。它的精确行为取决于为控件的 Style 属性设置的值。以下是选项的快速下载:

Yes, this is a feature of the standard ComboBox control. Its precise behavior depends on the value you set for the control's Style property. Here's a quick run-down of the options:


  • vbComboDropDown 默认样式。组合框看起来像一个带有下拉箭头的单行文本框。用户可以在文本框中输入任意文本,也可以从下拉列表中选择一个预定义的选项。

  • vbComboDropDown is the default style. The combo box looks like a single-line text box with a drop-down arrow. The user can either type arbitrary text into the text box, or they can select one of the pre-defined options from the drop-down list.

vbComboSimple 获取旧的经典样式组合框。这只是一个文本框融合在列表框的顶部(这就是组合框控件如何得到它的名字!)。与默认样式类似,用户可以在顶部的文本框中输入任意文本,也可以从下面的列表框中选择一个预定义的选项。

vbComboSimple gets you the old classic-style combo box. This is literally just a text box fused on top of a list box (and that's how the combo box control got its name!). Like the default style, the user can either type arbitrary text into the text box at the top, or they can select one of the pre-defined options from the list box underneath.

这种风格和默认风格之间唯一的区别是,所有可用的选项总是在屏幕上可见。

The only real difference between this style and the default style is that all of the available options are always visible on the screen. It takes up more screen real estate, but it makes it easier for the user to see exactly what their choices are.

vbComboDropDownList

vbComboDropDownList will produce a combo box that looks very much like the first (default) style, except that the user will not be able to type arbitrary text into the text box. They can only choose one of the pre-defined options available in the drop-down list.

作为我尽力而为的说明的补充,您还可以查看 Microsoft的文档为Win32组合框控件,完整的截图。 VB 6控件只是一个包装标准的Win32控件,所以你看到的一切,将是一样的VB 6应用程序。唯一的区别是样式的名称 - 而不是设置 CBS _ * 标志之一,您使用 vb * 常数。

As a supplement to my best-effort descriptions, you can also see Microsoft's documentation for the Win32 Combo Box control, complete with screenshots. The VB 6 control is just a wrapper around the standard Win32 control, so everything you see there will be the same for a VB 6 application. The only difference is the names of the styles—instead of setting one of the CBS_* flags, you use one of the vb* constants.

在这种情况下,它听起来像你想要的第一个选项, vbComboDropDown

In this case, it sounds like you want the first option, vbComboDropDown.

这篇关于组合或下拉框,用户可以输入自己的值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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