求帮做VB课程设计(打字游戏)
麻烦哪位VB高手帮下忙/求帮做个打字游戏,功能:1可以填加文本内容做为出题的内容,也就是说可以把自己写的文章拿来做速度练习的内容。2有时间条,时间一到就停止用户输入并计算...
麻烦哪位VB高手帮下忙/
求帮做个打字游戏,功能:
1可以填加文本内容做为出题的内容,也就是说可以把自己写的文章拿来做速度练习的内容。
2有时间条,时间一到就停止用户输入并计算正确率,考试时间只有三种给用户选择(5分钟,10分钟,15分钟)
能把程序发给我邮箱吗?
lszx423395484@yahoo.com.cn 展开
求帮做个打字游戏,功能:
1可以填加文本内容做为出题的内容,也就是说可以把自己写的文章拿来做速度练习的内容。
2有时间条,时间一到就停止用户输入并计算正确率,考试时间只有三种给用户选择(5分钟,10分钟,15分钟)
能把程序发给我邮箱吗?
lszx423395484@yahoo.com.cn 展开
2个回答
展开全部
Dim h As Integer
Dim n As Integer
Private Function zi()
Randomize
If Form1.Option1.Value Then
a = Int((122 - 97 + 1) * Rnd + 97)
ElseIf Form1.Option2.Value Then
a = Int((90 - 65 + 1) * Rnd + 65)
ElseIf Form1.Option3.Value Then
a = Int((126 - 48 + 1) * Rnd + 48)
End If
zi = Chr(a)
End Function
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim b As Integer
Dim c As Integer
b = -1
c = -1
For i = 0 To Label1.Count - 1
If Label1(i).Caption = Chr(KeyAscii) Then
If Label1(i).Top > b Then
c = i
End If
End If
Next
If c > -1 Then
Image1.Top = Label1(c).Top
Image1.Left = Label1(c).Left
Image1.Visible = True
Label1(c).Top = -10
Label1(c).Caption = zi
h = h + 1
Label2.Caption = "当前得分:" & h
If Form1.Option4.Value Then
h = h + 1
ElseIf Form1.Option5.Value Then
h = h + 2
ElseIf Form1.Option6.Value Then
h = h + 3
End If
End if
If KeyAscii = 27 Then
If MsgBox("真的要退出吗", vbYesNo) = vbYes Then
MsgBox "您的得分" & h & "分", , "成绩"
Unload Form2
Form1.Show
End If
End If
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Image1.Visible = False
End Sub
Private Sub Form_Load()
Dim lu As String
lu = App.Path
If Right(lu, 1) <> "/" Then
lu = lu & "/"
End If
lu = lu & "3.jpg"
Image1.Picture = LoadPicture(lu)
h = 0
n = 0
For i = 0 To Label1.Count - 1
Label1(i).Top = 0 - 380 * (i + 1)
Label1(i).Caption = zi
Next
End Sub
Private Sub Timer1_Timer()
For i = 0 To Label1.Count - 1
If Form1.Option4.Value Then
If h > 100 Then
Label1(i).Top = Label1(i).Top + 80
Else
Label1(i).Top = Label1(i).Top + 40
End If
ElseIf Form1.Option5.Value Then
If h > 200 Then
Label1(i).Top = Label1(i).Top + 120
Else
Label1(i).Top = Label1(i).Top + 60
End If
ElseIf Form1.Option6.Value Then
If h > 300 Then
Label1(i).Top = Label1(i).Top + 160
Else
Label1(i).Top = Label1(i).Top + 80
End If
End If
If Label1(i).Top > 6525 Then
n = n + 1
Label3.Caption = "掉落个数:" & n
Label1(i).Top = -10
Label1(i).Caption = zi
End If
If n = 27 Then
If MsgBox("掉落的个数已经超过" & n & "个,是否重新开始", vbYesNo) = vbYes Then
MsgBox "您的得分:" & h & "分", , "成绩"
Unload Form2
Form1.Visible = True
Exit Sub
Else
MsgBox "您的得分" & h & "分", , "成绩"
End
End If
End If
Next
End Sub
Dim n As Integer
Private Function zi()
Randomize
If Form1.Option1.Value Then
a = Int((122 - 97 + 1) * Rnd + 97)
ElseIf Form1.Option2.Value Then
a = Int((90 - 65 + 1) * Rnd + 65)
ElseIf Form1.Option3.Value Then
a = Int((126 - 48 + 1) * Rnd + 48)
End If
zi = Chr(a)
End Function
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim b As Integer
Dim c As Integer
b = -1
c = -1
For i = 0 To Label1.Count - 1
If Label1(i).Caption = Chr(KeyAscii) Then
If Label1(i).Top > b Then
c = i
End If
End If
Next
If c > -1 Then
Image1.Top = Label1(c).Top
Image1.Left = Label1(c).Left
Image1.Visible = True
Label1(c).Top = -10
Label1(c).Caption = zi
h = h + 1
Label2.Caption = "当前得分:" & h
If Form1.Option4.Value Then
h = h + 1
ElseIf Form1.Option5.Value Then
h = h + 2
ElseIf Form1.Option6.Value Then
h = h + 3
End If
End if
If KeyAscii = 27 Then
If MsgBox("真的要退出吗", vbYesNo) = vbYes Then
MsgBox "您的得分" & h & "分", , "成绩"
Unload Form2
Form1.Show
End If
End If
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Image1.Visible = False
End Sub
Private Sub Form_Load()
Dim lu As String
lu = App.Path
If Right(lu, 1) <> "/" Then
lu = lu & "/"
End If
lu = lu & "3.jpg"
Image1.Picture = LoadPicture(lu)
h = 0
n = 0
For i = 0 To Label1.Count - 1
Label1(i).Top = 0 - 380 * (i + 1)
Label1(i).Caption = zi
Next
End Sub
Private Sub Timer1_Timer()
For i = 0 To Label1.Count - 1
If Form1.Option4.Value Then
If h > 100 Then
Label1(i).Top = Label1(i).Top + 80
Else
Label1(i).Top = Label1(i).Top + 40
End If
ElseIf Form1.Option5.Value Then
If h > 200 Then
Label1(i).Top = Label1(i).Top + 120
Else
Label1(i).Top = Label1(i).Top + 60
End If
ElseIf Form1.Option6.Value Then
If h > 300 Then
Label1(i).Top = Label1(i).Top + 160
Else
Label1(i).Top = Label1(i).Top + 80
End If
End If
If Label1(i).Top > 6525 Then
n = n + 1
Label3.Caption = "掉落个数:" & n
Label1(i).Top = -10
Label1(i).Caption = zi
End If
If n = 27 Then
If MsgBox("掉落的个数已经超过" & n & "个,是否重新开始", vbYesNo) = vbYes Then
MsgBox "您的得分:" & h & "分", , "成绩"
Unload Form2
Form1.Visible = True
Exit Sub
Else
MsgBox "您的得分" & h & "分", , "成绩"
End
End If
End If
Next
End Sub
DFRobot
2024-11-10 广告
2024-11-10 广告
图形化编程是一种直观的编程方式,它通过拖拽图形化的编程积木来构建程序,降低了编程的学习门槛。在上海智位机器人股份有限公司,我们致力于将图形化编程应用于机器人教育等领域,使学习者能够以更加轻松、有趣的方式掌握编程技能。我们的图形化编程平台界面...
点击进入详情页
本回答由DFRobot提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询