vb中组合框(combo)怎样做到按“向下”键显示下拉列表?
如题。默认是按“向下”键选中并显示下一个list项的,但并不会显示出下拉列表。我要的就是如同鼠标点击箭头后的效果——显示出下拉列表,只不过,这里不要用鼠标而用“向下”键。...
如题。默认是按“向下”键选中并显示下一个list项的,但并不会显示出下拉列表。我要的就是如同鼠标点击箭头后的效果——显示出下拉列表,只不过,这里不要用鼠标而用“向下”键。
展开
2个回答
展开全部
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, vbNullString
End If
End Sub
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, vbNullString
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询