VB net keydown事件触发器选项卡索引

时间:2016-04-12 18:35:39

标签: vb.net

我已经设置了一个keydown事件来监控键盘键盘+ - 以及左右箭头。键109,107,39和37.我得到正确的键事件和键码,但是当我按下右箭头和左箭头时它也会触发选项卡索引。我还在tabindex触发但没有效果的所有相关按钮和标签上将tabstop设置为false。我可以完全禁用表格上的tabindex吗?以下代码为Keydown。

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    '   If e.KeyCode = Keys.N Then
    '   MsgBox(e.KeyCode)

    Select Case e.KeyCode

        Case 109                        '// (-) Key

            If intSequenceNumber = 0 Then
            '//Do nothing
        Else
            intSequenceNumber = intSequenceNumber - 1
            Label_ChaseNumber.Text = intSequenceNumber + 1

            LoadStepPattern()

        End If


        Case 107                        '// (+) Key

            If intSequenceNumber < 99 Then

            intSequenceNumber = intSequenceNumber + 1
            Label_ChaseNumber.Text = intSequenceNumber + 1

            LoadStepPattern()

        End If


        Case 39                       '// (Right Arrow) Key

            If intStepNumber < 99 Then

                ResetAllBorders()

                intStepNumber = intStepNumber + 1
                PicPixel(intStepNumber).BorderStyle = BorderStyle.Fixed3D
            End If


        Case 37                       '// (Right Arrow) Key

            If intStepNumber = 0 Then
                'Do Noting

            Else

                ResetAllBorders()

                intStepNumber = intStepNumber - 1
                PicPixel(intStepNumber).BorderStyle = BorderStyle.Fixed3D
            End If

    End Select


End Sub

End Class

0 个答案:

没有答案