0

当同时按下多个键时,如何发送字符串/消息框?我都试过了AndAndalso但结果是只需要第一个键来弹出那个 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
4

1 回答 1

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

请注意,这

于 2013-10-25T15:48:30.053 回答