' 如果非要这样做的话也可以这样,不过同意victorycyz(中海)的看法,最好不这样做。 ' 按 Alt + 1 选中ComboBox中的第一项。Option ExplicitPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKey1 And Shift = vbAltMask Then Combo1.ListIndex = 0 End If End SubPrivate Sub Form_Load() Dim i As Long Me.KeyPreview = True For i = 1 To 10 Combo1.AddItem CStr(i) Next i End Sub
我觉得界面设计应该尽量符合一般的习惯。你这样的设想,我认为不妥,原因如下:1. 除非操作人员对combobox中的内容非常熟悉,否则,这样的快捷方式一般没有人会用它。2. 在windows98中,alt+数字键一般用来切换输入法。你把它重定义的话,容易对用户的操作造成干扰。
' 按 Alt + 1 选中ComboBox中的第一项。Option ExplicitPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKey1 And Shift = vbAltMask Then
Combo1.ListIndex = 0
End If
End SubPrivate Sub Form_Load()
Dim i As Long
Me.KeyPreview = True
For i = 1 To 10
Combo1.AddItem CStr(i)
Next i
End Sub