VB打字程序
来源:互联网 发布:淘宝哪种推广方法最好 编辑:程序博客网 时间:2024/05/16 15:03
Option Explicit
Dim score As Integer
Dim speed As Integer
Sub init()
Label1.Caption = Chr(Int(Rnd * 25) + 65) '大写英文字母
speed = Int(Rnd * 50 + 50) '速度随机
Label1.Left = Int(Rnd * Frame1.Width) '左侧位置随机
Label1.Top = Frame1.Top 'top,left属性为器件顶端,左侧和容器边缘的距离
End Sub
Sub init1()
Label6.Caption = Chr(Int(Rnd * 25) + 97) 'chr转为对应的asc码
speed = Int(Rnd * 50 + 50)
Label6.Left = Int(Rnd * Frame1.Width)
Label6.Top = Frame1.Top
End Sub
Private Sub Command1_Click()
init
Timer1.Enabled = True
Timer2.Enabled = True
Command1.Visible = False
Label5.Caption = 20
Label3.Caption = 0
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = Label1.Caption Then
init
score = score + 1
Label3.Caption = score
End If
If Chr(KeyAscii) = Label6.Caption Then
init1
score = score + 1
Label3.Caption = score
End If
End Sub
Private Sub Form_Load()
Randomize
Timer1.Enabled = False
Timer2.Enabled = False
End Sub
Private Sub Timer1_Timer() '设置为100毫秒
Label1.Top = Label1.Top + speed
If Label1.Top > Frame1.Height Then
init
End If
Label6.Top = Label6.Top + speed
If Label6.Top > Frame1.Height Then
init1
End If
End Sub
Private Sub Timer2_Timer()
Label5.Caption = Val(Label5.Caption) - 1
If Val(Label5.Caption) <= 0 Then
Timer1.Enabled = False
Label1.Caption = ""
Label6.Caption = ""
Select Case score
Case Is <= 8
MsgBox vbCrLf + "别放弃,再来一次!", , "结果" 'vbcr是回车,本行开头,vblf是换行,跳到下一行,vbcrlf是回车换行,到下一行开头
Case Is < 12
MsgBox vbCrLf + "成绩不错,加油!", , "结果"
Case Is < 15
MsgBox vbCrLf + "再努力做的更好一些!", , "结果"
Case Is > 18
MsgBox vbCrLf + "好厉害!最高分呀!", , "结果"
End Select
Command1.Visible = True
Label3.Caption = 0
Label5.Caption = 20
score = 0
Timer1.Enabled = False
Timer2.Enabled = False
End If
End Sub
- VB打字程序
- VB,打字游戏
- vb.net 打字练习
- vb.net 打字练习
- 键盘打字程序源代码
- MASM-打字练习程序
- 一个汇编打字游戏程序
- 打字
- 打字
- 打字
- 打字
- 打字
- 打字
- 打字
- 打字
- 打字
- 打字
- vb 程序
- html标签meta
- 电信光猫破解 (打开无线wifi及路由功能)
- js获取url参数值
- Java中Split函数的用法 注意点
- 关于!this.IsPostBack 使用介绍
- VB打字程序
- MFC与windows API的关系
- 如何使用代码美化器Uncrustify (How to use code beautifier Uncrustify)
- 用setsockopt()来控制recv()与send()的超时
- uva 10161 Ant on a Chessboard 蛇形矩阵 简单数学题
- 【xinfanqie】苹果电脑iso系统要如何安装win7驱动
- Android: BitmapFactory.decodeResource BitmapFactory.decodeStream区别
- 建立物化視圖
- HQL中的Like查询需要注意的地方及详细示例