好的,所以当我有一个combobox
DropDownList
样式并希望从中获得ctrl + c时,它会产生两件事:
更改AutoComplete
属性并没有做任何事情 - 我是否将其设置为Append
,Suggest
,SuggestAppend
甚至是{并不重要{1}}。改变DropDownStyle对我来说是不可接受的。
所以我想知道 - 如果有办法:
??提前谢谢!
答案 0 :(得分:1)
嗯,这是按下Ctrl键时“不改变我在combobox中的当前选择”的一种方法
将ComboBox1
设置为DropDownList
Dim currentIndex As Integer
Private Sub ComboBox1_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
If Char.IsControl(e.KeyChar) Then
currentIndex = ComboBox1.SelectedIndex
End If
End Sub
Private Sub ComboBox1_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyUp
If e.KeyCode = Keys.ControlKey Then
ComboBox1.SelectedIndex = currentIndex
End If
End Sub