如何在 C# 的组合框中禁用元素编辑? [英] How to disable editing of elements in combobox for c#?
本文介绍了如何在 C# 的组合框中禁用元素编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ComboBox(带有 C# 的 WinForms)中有一些元素.我希望它们的内容是静态的,以便用户在应用程序运行时无法更改其中的值.我也不希望用户向 ComboBox 添加新值
I have some elements in a ComboBox (WinForms with C#). I want their content to be static so that a user cannot change the values inside when the application is ran. I also do not want the user adding new values to the ComboBox
推荐答案
使用 ComboStyle 属性:
Use the ComboStyle property:
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
这篇关于如何在 C# 的组合框中禁用元素编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文