如何在同时按下多个键时发送字符串/消息框?
我已尝试And
以及Andalso
,但结果是只需要第一个键来弹出该msgbox。
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _
ByVal keyData As System.Windows.Forms.Keys) _
As Boolean
If msg.WParam.ToInt32() = CInt(Keys.ShiftKey) AndAlso CInt(Keys.A) Then
MsgBox("Testing")
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
答案 0 :(得分:2)
您可以这样做:
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _
ByVal keyData As System.Windows.Forms.Keys) _
As Boolean
If keyData = (Keys.Shift Or Keys.A) Then
MessageBox.Show("Shift-A")
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
注意这个