分时图战法:有谁能帮我编一个程序出来,用来测试打字速度的

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 08:38:59
有谁能帮我编一个程序出来,用来测试打字速度的我要的是程序代码

新建VB的EXE工程
添加2个Timer控件,把第一个的inte 属性设置为60000及一分钟运行一次
第二个的属性设置为1000,一秒运行一次
然后添加2个TEXTBOX,第一个用做打字,第二个设置时间,一个COMMAND按钮,然后把如下代码拷贝进去,运行。一个label控件,用来显示打字速度结果
=======================================================
Dim i As Integer
Private Sub Command1_Click()
Text2.Enabled = False
i = 0
Timer1.Enabled = True
End Sub

Private Sub Form_Load()

End Sub

Private Sub Timer1_Timer()
i = i + 1
End Sub

Private Sub Timer2_Timer()
If Text2.Text <> "" Then
If i = CInt(Text2.Text) Then
Timer1.Enabled = False
MsgBox "您在" & Text2.Text & "分钟里打了" & Len(Text1.Text) & "个字!平均每分钟打" & CInt(Len(Text1.Text)) / CInt(Text2.Text) & "个字", vbOKOnly + vbInformation, "提示"
Label2.Caption = "您在" & Text2.Text & "分钟里打了" & Len(Text1.Text) & "个字!平均每分钟打" & CInt(Len(Text1.Text)) / CInt(Text2.Text) & "个字"
Timer2.Enabled = False
Text2.Enabled = True
End If
End If
End Sub
=================================================
或者把如下代码拷贝到文本文件里。另存为Form1.frm,然后用VB打开就可以
==================================================
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6930
ClientLeft = 60
ClientTop = 345
ClientWidth = 8745
LinkTopic = "Form1"
ScaleHeight = 6930
ScaleWidth = 8745
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer2
Interval = 100
Left = 3960
Top = 6480
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 60000
Left = 3600
Top = 6480
End
Begin VB.CommandButton Command1
Caption = "开始"
Height = 255
Left = 7440
TabIndex = 2
Top = 6480
Width = 855
End
Begin VB.TextBox Text2
Height = 270
Left = 6480
TabIndex = 1
Top = 6480
Width = 495
End
Begin VB.TextBox Text1
Height = 6255
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 0
Width = 8295
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 0
TabIndex = 4
Top = 6480
Width = 90
End
Begin VB.Label Label1
Caption = "设置测试时间(分):"
Height = 255
Left = 4680
TabIndex = 3
Top = 6480
Width = 1695
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Command1_Click()
Text2.Enabled = False
i = 0
Timer1.Enabled = True
End Sub

Private Sub Form_Load()

End Sub

Private Sub Timer1_Timer()
i = i + 1
End Sub

Private Sub Timer2_Timer()
If Text2.Text <> "" Then
If i = CInt(Text2.Text) Then
Timer1.Enabled = False
MsgBox "您在" & Text2.Text & "分钟里打了" & Len(Text1.Text) & "个字!平均每分钟打" & CInt(Len(Text1.Text)) / CInt(Text2.Text) & "个字", vbOKOnly + vbInformation, "提示"
Label2.Caption = "您在" & Text2.Text & "分钟里打了" & Len(Text1.Text) & "个字!平均每分钟打" & CInt(Len(Text1.Text)) / CInt(Text2.Text) & "个字"
Timer2.Enabled = False
Text2.Enabled = True
End If
End If
End Sub

上网有得下载,不用自己编

金山打字通,可以测试五笔、全拼及各种输入法的录入速度

你不是练习打字,是想练习编程吧