VB打字游戏 不行
DimsAsIntegerPrivateSubCommand1_Click()s=0Command1.Visible=FalseCommand2.Visible=True...
Dim s As Integer
Private Sub Command1_Click()
s = 0
Command1.Visible = False
Command2.Visible = True
Timer1.Interval = 60000
Timer2.Interval = 10
Label1.Caption = "分数" & s
Timer1.Enabled = True
Timer2.Enabled = True
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.FontSize = 40
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Chr(KeyCode) = Label2.Caption Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
s = s + 10
Label1.Caption = "分数" & s
End If
End Sub
Private Sub command2_Click()
Command3.Visible = True
Command4.Visible = True
End Sub
Private Sub Command4_Click()
Unload Me
Form1.Show
End Sub
Private Sub Form_Load()
Command2.Visible = False
Command3.Visible = False
Command4.Visible = False
End Sub
Private Sub Label_Click()
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
Timer2.Interval = 0
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Timer2_Timer()
Label2.Top = Label2.Top + 40
If Label2.Top > Me.Height Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
运行后,识别不了键盘? 展开
Private Sub Command1_Click()
s = 0
Command1.Visible = False
Command2.Visible = True
Timer1.Interval = 60000
Timer2.Interval = 10
Label1.Caption = "分数" & s
Timer1.Enabled = True
Timer2.Enabled = True
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.FontSize = 40
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Chr(KeyCode) = Label2.Caption Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
s = s + 10
Label1.Caption = "分数" & s
End If
End Sub
Private Sub command2_Click()
Command3.Visible = True
Command4.Visible = True
End Sub
Private Sub Command4_Click()
Unload Me
Form1.Show
End Sub
Private Sub Form_Load()
Command2.Visible = False
Command3.Visible = False
Command4.Visible = False
End Sub
Private Sub Label_Click()
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 0
Timer2.Interval = 0
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Timer2_Timer()
Label2.Top = Label2.Top + 40
If Label2.Top > Me.Height Then
Label2.Caption = Chr(Int(Rnd() * 26) + 65)
Label2.Top = 0
Label2.Left = Int(Rnd() * (Me.Width - Label2.Width))
End If
End Sub
运行后,识别不了键盘? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询