用VB写的打字游戏程序,怎么计算得分?自由下落的字是用Label,想用另一个Label来计算键盘输入对的个数。。。请问要怎么写代码?
Private Sub Form1_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
If LCase(Trim(Label1.Text)) = LCase(Chr(KeyCode)) Then
用VB写的打字游戏程序,怎么计算得分?自由下落的字是用Label,想用另一个Label来计算键盘输入对的个数。。。请问要怎么写代码?
Private Sub Form1_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
If LCase(Trim(Label1.Text)) = LCase(Chr(KeyCode)) Then
先定义一个模块级变量
private CorrectCount as integer'记录用户按钮正确的次数
Private Sub Form1_KeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer)
If LCase(Label1.caption) = LCase(Chr(KeyCode)) Then
CorrectCount=CorrectCount+1
label1.caption=correctcount
end if
end sub