按下键时未检测到KeyDown

时间:2014-03-03 13:14:49

标签: vb.net

Public Class frmWhoIsFaster
    Dim player1clicks As Integer
    Dim player2clicks As Integer
    Dim startgame As Boolean = True
    Private Sub frmWhoIsFaster_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If startgame = True Then
            Select Case e.KeyCode
                Case Keys.A
                    player1clicks += 1
                    lblPlayer1Clicks.Text = "Player 1 clicks: 1" & player1clicks
                Case Keys.L
                    player2clicks += 1
                    lblPlayer2Clicks.Text = "Player 2 clicks: " & player2clicks
            End Select
        End If
    End Sub
End Class

按A或L时标签永远不会改变

0 个答案:

没有答案