WinForms 中的只读组合框 [英] Readonly ComboBox in WinForms

查看:13
本文介绍了WinForms 中的只读组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用设计器和 WinForms 在 C#、Visual Studio 2008 中编写 GUI.我有一个 ComboBox 控件,我希望它只允许从提供的选项中进行选择,而不接受用户输入的字符串.它似乎没有 ReadOnly 属性,禁用它会妨碍控件的可读性(以及禁止用户选择).

I'm writing a GUI in C#, Visual Studio 2008, using the Designer and WinForms. I've got a ComboBox control, and I'd like it to only allow to select from the provided options and not to accept a user-entered string. It doesn't appear to have a ReadOnly property, and disabling it hinders the readability of the control (as well as disallowing user-selection).

推荐答案

将 DropDownStyle 设置为DropDownList"

Set DropDownStyle to "DropDownList"

这篇关于WinForms 中的只读组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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