收藏 分享(赏)

打字练习代码.doc

上传人:tkhy51908 文档编号:7726120 上传时间:2019-05-24 格式:DOC 页数:7 大小:31.50KB
下载 相关 举报
打字练习代码.doc_第1页
第1页 / 共7页
打字练习代码.doc_第2页
第2页 / 共7页
打字练习代码.doc_第3页
第3页 / 共7页
打字练习代码.doc_第4页
第4页 / 共7页
打字练习代码.doc_第5页
第5页 / 共7页
点击查看更多>>
资源描述

1、 最近发现很对人需要打字程序的代码,新作了一个,还有些小功能可以自己补充。ZIP 发不上来,只能让大家自己复制下去了。Option ExplicitSub cswz() 产生位置Randomizewz = Rnd() * (Picture1.Width - 200)End SubSub cszm()RandomizeIf nd = 1 Thenzm = Chr(Int(26 * Rnd + 65)Label1(0).Caption = Chr(Int(90 - 65 + 1) * Rnd + 65) 产生一个介于 65 到 90 之间的随机数ElseIf nd = 2 Thenzm = Chr

2、(Int(58 * Rnd + 65)Elsezm = Chr(Int(75 * Rnd + 48)End IfEnd SubPrivate Sub Command1_Click()df = 0Command4.Visible = FalseCommand1.Visible = Falsesdsd 调用产生速度设定值Timer1.Interval = sd1syt = 200Picture1.SetFocuscswz 调用产生位置子程序Label1(0).Left = wzcswz 调用产生位置子程序Label1(1).Left = wzcswz 调用产生位置子程序Label1(2).Left

3、 = wzcswz 调用产生位置子程序Label1(3).Left = wzcswz 调用产生位置子程序Label1(4).Left = wzcswz 调用产生位置子程序Label1(5).Left = wzcszm 调用产生字母子程序Label1(0).Caption = zmcszm 调用产生字母子程序Label1(1).Caption = zmcszm 调用产生字母子程序Label1(2).Caption = zmcszm 调用产生字母子程序Label1(3).Caption = zmcszm 调用产生字母子程序Label1(4).Caption = zmcszm 调用产生字母子程序La

4、bel1(5).Caption = zmTimer1.Enabled = True 激活 Time1 控件Timer2.Enabled = True 激活 Time2 控件Label3.Caption = “当前得分:“ & dfLabel4.Caption = “剩余时间:“ & sytLabel2.Caption = “当前难度等级:“ & ndLabel5.Caption = “当前速度等级:“ & sdEnd SubPrivate Sub Command2_Click()EndEnd SubPrivate Sub Command4_Click()Form2.ShowEnd SubPri

5、vate Sub Form_Load()RandomizeTimer1.Enabled = False Time1 控件失效Timer2.Enabled = False Time2 控件失效Command1.Visible = FalseEnd SubPrivate Sub Picture1_KeyPress(KeyAscii As Integer)If Chr(KeyAscii) = Label1(0).Caption Thendf = df + 1BeepLabel3.Caption = “当前得分:“ & dfcszmcswzLabel1(0).Left = wzLabel1(0).Ca

6、ption = zmLabel1(0).Top = 0ElseIf Chr(KeyAscii) = Label1(1).Caption Thendf = df + 1BeepLabel3.Caption = “当前得分:“ & dfcszmcswzLabel1(1).Left = wzLabel1(1).Caption = zmLabel1(1).Top = 0ElseIf Chr(KeyAscii) = Label1(2).Caption Thendf = df + 1BeepLabel3.Caption = “当前得分:“ & dfcszmcswzLabel1(2).Left = wzLa

7、bel1(2).Caption = zmLabel1(2).Top = 0ElseIf Chr(KeyAscii) = Label1(3).Caption Thendf = df + 1Label3.Caption = “当前得分:“ & dfcszmcswzBeepLabel1(3).Left = wzLabel1(3).Caption = zmLabel1(3).Top = 0ElseIf Chr(KeyAscii) = Label1(4).Caption Thendf = df + 1BeepLabel3.Caption = “当前得分:“ & dfcszmcswzLabel1(4).L

8、eft = wzLabel1(4).Caption = zmLabel1(4).Top = 0ElseIf Chr(KeyAscii) = Label1(5).Caption Thendf = df + 1BeepLabel3.Caption = “当前得分:“ & dfcszmcswzLabel1(5).Left = wzLabel1(5).Caption = zmLabel1(5).Top = 0End IfEnd SubPrivate Sub Timer1_Timer()Label1(0).Top = Label1(0).Top + Rnd * 300Label1(1).Top = La

9、bel1(1).Top + Rnd * 300Label1(2).Top = Label1(2).Top + Rnd * 300Label1(3).Top = Label1(3).Top + Rnd * 300Label1(4).Top = Label1(4).Top + Rnd * 300Label1(5).Top = Label1(5).Top + Rnd * 300If Label1(0).Top Picture1.Height ThencszmcswzLabel1(0).Left = wzLabel1(0).Caption = zmLabel1(0).Top = 0End IfIf L

10、abel1(1).Top Picture1.Height ThencszmcswzLabel1(1).Left = wzLabel1(1).Caption = zmLabel1(1).Top = 0End IfIf Label1(2).Top Picture1.Height ThencszmcswzLabel1(2).Left = wzLabel1(2).Caption = zmLabel1(2).Top = 0End IfIf Label1(3).Top Picture1.Height ThencszmcswzLabel1(3).Left = wzLabel1(3).Caption = zm

11、Label1(3).Top = 0End IfIf Label1(4).Top Picture1.Height ThencszmcswzLabel1(4).Left = wzLabel1(4).Caption = zmLabel1(4).Top = 0End IfIf Label1(5).Top Picture1.Height ThencszmcswzLabel1(5).Left = wzLabel1(5).Caption = zmLabel1(5).Top = 0End IfEnd SubPrivate Sub Timer2_Timer() 剩余时间扣除计时syt = syt - 1 扣除剩

12、余个数中的一个Label4.Caption = “剩余时间:“ & sytIf syt 180MsgBox vbCrLf + “好厉害!最高分呀!“End SelectCommand4.Visible = TrueTimer1.Enabled = FalseTimer2.Enabled = FalseLabel1(0).Caption = “Label1(1).Caption = “Label1(2).Caption = “Label1(3).Caption = “Label1(4).Caption = “Label1(5).Caption = “Label1(0).Top = 0Label1

13、(1).Top = 0Label1(2).Top = 0Label1(3).Top = 0Label1(4).Top = 0Label1(5).Top = 0End IfEnd Sub设定窗口代码:Option ExplicitPrivate Sub Command1_Click()If Option1.Value = True Thennd = 1ElseIf Option2.Value = True Thennd = 2Elsend = 3End IfIf Option4.Value = True Thensd = 1ElseIf Option5.Value = True Thensd =

14、 2Elsesd = 3End IfForm2.HideForm1.Command1.Visible = TrueEnd SubPrivate Sub Form_Load()Option1.Value = TrueOption4.Value = TrueEnd SubPrivate Sub Form_Unload(Cancel As Integer)Form2.HideEnd Sub模块代码:Option ExplicitPublic nd, sd, sd1 As Integer 定义公共变量 难度和速度Public df, syt, wz As Integer 定义公共变量 分数 剩余时间Public zm As String 定义随机产生的字母Public Sub sdsd() 定义速度值If sd = 1 Thensd1 = 800ElseIf sd = 2 Thensd1 = 500Elsesd1 = 300End IfEnd Sub

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 中等教育 > 教学研究

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报