C# combox不能输入的解决方法

来源:互联网 发布:ae软件好学吗 编辑:程序博客网 时间:2024/06/03 01:52

使Combox不能输入的两种方法。

方法一、 选择combox的    DropDownStyle = DropDownList    选择框不能输入。

方法二、

      (1)选择 combox的    DropDownStyle = DropDown;    

      (2)设置combox的  KeyPress事件

       private void cbDeviceType_KeyPress(object sender, KeyPressEventArgs e)
        {
            e.Handled = true;//取消输入事件
        }

0 0
原创粉丝点击