技术开发 频道

C#实现全键盘操作comboBox


【IT168技术文档】

private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { // if条件检测按下的是不是Enter键 if(e.KeyChar == (char)13) { if(!this.comboBox1.DroppedDown) { this.comboBox1.DroppedDown = true; e.Handled = true; } } }
  以上方法可以通过回车键和光标上下键,来实现comboBox的下拉一览和数据选择。
0
相关文章