0

我正在为我的代码编写一些键盘输入,但我无法弄清楚如何获取需要 actrl或input的alt键。shift我试过这个,但这只是在我按下alt键时使键工作。我正在尝试使用+不在数字键盘上的按钮。

Case Keys.ShiftKey And Keys.Oemplus
            BTB_plus.PerformClick()

而且 Usingkeys.Shift什么都不做

此外,如果有人列出了 VB.NET 中哪个键具有什么名称,我们将不胜感激。(或关于这个主题的好教程)

如果有人可以发布选择案例语句的代码,我会更喜欢,谢谢

4

2 回答 2

3

如果您想使用 case 语句,我将执行以下操作:

Dim bHandled As Boolean = False
    Select Case e.Modifiers
        Case Keys.Control
            If e.KeyCode = Keys.Oemplus Then
                MsgBox("KeyPress CTRL + OEMPLUS")
                e.Handled = True
            End If

            If e.KeyCode = Keys.A Then
                MsgBox("KeyPress CTRL + A")
                e.Handled = True
            End If


        Case Keys.Shift
            If e.KeyCode = Keys.Oemplus Then
                MsgBox("KeyPress Shift + OEMPLUS")
                e.Handled = True
            End If

            If e.KeyCode = Keys.A Then
                MsgBox("KeyPress Shift + A")
                e.Handled = True
            End If

    End Select
于 2013-09-01T20:35:34.983 回答
0

这应该能让你到达那里:)

If e.KeyCode = Keys.Oemplus And e.Modifiers = Keys.Control Then
    MsgBox("KeyPress CTRL + OEMPLUS")
    e.Handled = True
End If

http://msdn.microsoft.com/en-us/library/system.windows.forms.keys.aspx

于 2013-08-31T01:31:50.187 回答