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

运行后,识别不了键盘?
展开
 我来答
ljeqaz
2015-06-20 · 超过32用户采纳过TA的回答
知道答主
回答量:69
采纳率:0%
帮助的人:51.9万
展开全部
这个问题简单,只需要在 Form_Load() 中加入这句代码就可以了:Me.KeyPreview = True

Form_Load() 修改为:
Private Sub Form_Load()
Command2.Visible = False
Command3.Visible = False
Command4.Visible = False
Me.KeyPreview = True
End Sub

记得采纳哦!!!!!
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式