VB编写的打字程序

作者&投稿:方溥 (若有异议请与网页底部的电邮联系)
编写一个VB的英文打字练习程序 完整代码~

Dim m, s As Double
Private Sub Command1_Click()
Text2.Text = ""
Text1.Text = ""
For i = 1 To 30
Text2.Text = Text2.Text & Chr(Int(Rnd * 25 + 66))
Next i
Timer1.Enabled = True
Timer1.Interval = 1000
m = 0
s = 1
End Sub
Private Sub Command2_Click()
Dim b As Integer
For i = 1 To 30
If Mid(Text1.Text, i, 1) = Mid(Text2.Text, i, 1) Then b = b + 1
Next i
Text3.Text = Int(b / 30 * 100) & "%"
Timer1.Enabled = False
Timer1.Interval = 0
Text4.Text = m & "分" & s & "秒"
End Sub
Private Sub Form_Load()
Text3.Text = ""
Text4.Text = ""
Text2.Text = ""
Text1.Text = ""
For i = 1 To 30
Text2.Text = Text2.Text & Chr(Int(Rnd * 25 + 66))
Next i
Command1.Caption = "重新生成"
Command2.Caption = "计算"
Label1.Caption = "准确率"
Label2.Caption = "用时"
Text1.Locked = True
Text1.MaxLength = 30
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 And Len(Text1.Text) >= 1 Then Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
If KeyAscii > 64 And KeyAscii < 91 Then Text1.Text = Text1.Text & Chr(KeyAscii)
If KeyAscii > 96 And KeyAscii < 123 Then Text1.Text = Text1.Text & Chr(KeyAscii - 32)
End Sub
Private Sub Timer1_Timer()
If s > 60 Then s = 0: m = m + 1
s = s + 1
End Sub

Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Label1.Text = "姓名" Label2.Text = "性别" Label3.Text = "爱好" RadioButton1.Text = "男" RadioButton2.Text = "女" CheckBox1.Text = "篮球" CheckBox2.Text = "羽毛球" CheckBox3.Text = "足球" CheckBox4.Text = "乒乓球" CheckBox5.Text = "下棋" CheckBox6.Text = "游泳" TextBox1.Text = "" Button1.Text = "确定" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim str As String = "" str = str & TextBox1.Text & " " If RadioButton1.Checked = True Then str = str & "性别:男 " Else str = str & "性别:女 " End If str = str & "兴趣爱好:" If CheckBox1.Checked = True Then str = str & "篮球 " End If If CheckBox2.Checked = True Then str = str & "羽毛球 " End If If CheckBox3.Checked = True Then str = str & "足球 " End If If CheckBox4.Checked = True Then str = str & "乒乓球 " End If If CheckBox5.Checked = True Then str = str & "下棋 " End If If CheckBox6.Checked = True Then str = str & "游泳 " End If ComboBox1.Items.Add(str) End SubEnd Class

我有,当年自己写的一个得过<省二等奖><市一等奖>的作品!

功能:运行打错字,回退键重要,打对字实现“打勾”,与打错字“打差”统计正确率,速度,图形界面显示键盘图。。。(2万行左右代码)
Private Sub Text1_Change(Index As Integer)
On Error GoTo text1changewrong:
' Print Mid(Label1(myord Mod 7).Caption, begin + 1, myend - begin + 1)

MouseSetfocusOrAutoSetfocus = False '把是否用标点text1(0)标记变为不是(false)
Text1(Index).IMEMode = 9 '用于改变输入法状态
backyn = False '让退格可以用
Label3.Caption = "myend" & Str(myend)
Label4.Caption = "begin" & Str(begin)
If key = 1 Then '如果k=1 '清空文本框
For i = 0 To 6
Text1(i).Text = ""
Text1(i).Enabled = False
Label2(i).Caption = ""
Next i
Text1(0).Enabled = True
key = 0
'此处应变题(出题, 待作:...........)
End If
If delete = 0 Then
myend = Text1(myord Mod 7).SelStart + 1
Else
myend = myend - 1
begin = begin - 1
End If
If myend - begin <> 0 Then
tmstr$ = Mid(Label1(myord Mod 7).Caption, begin, myend - begin)
dtstr$ = Mid(Text1(myord Mod 7).Text, begin, myend - begin)
If tmstr = " " And dtstr = " " Then
Label2(myord Mod 7).Caption = Label2(myord Mod 7).Caption & " "
yorn(Text1(Index).SelStart) = 2
' GoTo kung:

'这里下

Else

If tmstr$ = dtstr$ Then
Label2(myord Mod 7).Caption = Label2(myord Mod 7).Caption + "√"
y = y + 1 '对的加一个
Label5.Caption = "正确:" & Str(y) & " 个字"
yorn(Text1(Index).SelStart) = 1
Else
Label2(myord Mod 7).Caption = Label2(myord Mod 7).Caption + "×"
n = n + 1 '错的加一个
Label6.Caption = "错误:" & Str(n) & "个字"
yorn(Text1(Index).SelStart) = 0
End If
End If
End If
If y >= 1 Then '除数不可为0
Label7.Caption = "正确率:" & left(Str((y / (y + n)) * 100), 5) & "%" '在label7上显示[正确率]
Correctness = left(Str((y / (y + n)) * 100), 5) '用于写文件时用的
Else
Label7.Caption = "正确率:" & 0# & "%" '在label7上显示[正确率]
Correctness = 0# '用于写文件时用的
End If
If Text1(myord Mod 7).SelStart >= Len(RTrim(Label1(myord Mod 7).Caption)) Then
If Text1((Index + 1) Mod 7).Visible = False Then
MsgBox "正确:" & Str(y) & "个 " & Label7.Caption & Chr(13) & Chr(10) & "错误:" & Str(n) & "个 " & Label8.Caption, 64, "测试报告"
Close #1
'Form2.Show
Unload Me

Exit Sub

'水有文单
End If
Text1(myord Mod 7).SelStart = 1
myord = myord + 1
If myord Mod 7 = 0 Then

key = 1 '用key=1 表示要清空所有文本框
For m = 0 To 6
Text1(m).Enabled = True
Next m
End If
begin = 1
delete = 0
Label2(myord Mod 7).Caption = ""
For u = 0 To 6
Text1(u).Enabled = False
Next u
Text1(myord Mod 7).Enabled = True
If Text1(myord Mod 7).Visible = True Then Text1(myord Mod 7).SetFocus
Text1(myord Mod 7).Text = ""

End If
'*******************************此段用于locked文本框*******
If myord Mod 7 <> 0 Then Text1(myord Mod 7 - 1).Enabled = False
'***************************************************
begin = myend
Exit Sub
text1changewrong:
MsgBox "系统出错,将要关闭!", 32, "系统提示"
Unload Me
End Sub

Private Sub Text1_GotFocus(Index As Integer)
Dim tuige As Integer '用于保存text、label 应退的格数

If MouseSetfocusOrAutoSetfocus = True Then Exit Sub

Text1(Index).IMEMode = 9 '用于改变输入法状态

If Text1(Index).Text <> "" Then backyn = True '未验证
myord = Index
If Text1(myord Mod 7).Text = "" Then
begin = 1
myend = 0
Else
begin = Len(Text1(myord Mod 7).Text)
myend = Len(Text1(myord Mod 7).Text) + 1
Label2(myord Mod 7).Caption = left(Label2(myord Mod 7).Caption, Len(Text1(myord Mod 7).Text))
End If
If Index = 0 Then
If callkey = 0 Then
getnum = 0 '如果form1是刚打开,则从list1的第一行开始读数据
y = 0
n = 0
End If
callkey = callkey + 1
If callkey Mod 2 <> 0 Then

For i = 0 To 6
mytxt = List1.List(getnum)

getnum = getnum + 1
If Not (getnum > List1.ListCount) Then

'a: ' Line Input #1, mytxt

'If Not (Len(Trim(mytxt)) >= 1) Then GoTo a:

If Len(mytxt) > 37 Then mytxt = left(mytxt, 37)
'Label1(i).Left = Label1(i).Left + (Len(mytxt) - Len(LTrim(mytxt))) * (50 / 3)
'Label2(i).Left = Label1(i).Left + (Len(mytxt) - Len(LTrim(mytxt))) * (50 / 3)
'Text1(i).Left = Text1(i).Left + (Len(mytxt) - Len(LTrim(mytxt))) * (50 / 3)

Text1(i).left = 550 '每次都让label的位置还原
Label1(i).left = 600 '每次都让label的位置还原
Label2(i).left = 600 '每次都让label的位置还原

Label1(i).Caption = RTrim(mytxt) '"共和国中华人民共和国中华人民共和国中华人民共和国中华人民共和国韦"
tuige = (Len(RTrim(mytxt)) - Len(Trim(mytxt))) * Int(7695 / 37)
Label1(i).Caption = Trim(Label1(i).Caption) '"共和国中华人民共和国中华人民共和国中华人民共和国中华人民共和国韦"

Text1(i).left = Text1(i).left + tuige '退
Label1(i).left = Label1(i).left + tuige '退
Label2(i).left = Label2(i).left + tuige '退

Text1(i).Text = ""
Label2(i).Caption = ""

Text1(i).MaxLength = Len(Trim(Label1(i).Caption))
Text1(i).Width = Label1(i).Width + 100
Label1(i).Visible = True
Label2(i).Visible = True
Text1(i).Visible = True

Else
'Label1(i - 1).Visible = False
' Label2(i - 1).Visible = False
' Text1(i - 1).Visible = False

Exit For
End If
Next i
End If

End If
ReDim yorn(Len(Label1(Index).Caption)) As Integer
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
'Text1(Index).IMEMode = 1

If KeyCode = 37 Or KeyCode = 39 Or KeyCode = 38 Or KeyCode = 40 Or KeyCode = 35 Or KeyCode = 36 Or KeyCode = 46 Then KeyCode = 0

If backyn = True And KeyCode = 8 Then KeyAscii = 0: Exit Sub: backyn = False

If KeyCode = 8 And Text1(myord Mod 7).SelStart <> 0 Then
If yorn(Text1(Index).SelStart) = 1 Then y = y - 1: Label5.Caption = "正确:" & Str(y) & " 个字" 'Else n = n - 1: Label6.Caption = "错误:" & Str(n) & "个字" '用于减少对与错的量(y\n)
If yorn(Text1(Index).SelStart) = 0 Then n = n - 1: Label6.Caption = "错误:" & Str(n) & " 个字"
delete = 1
Label2(myord Mod 7).Caption = left(Label2(myord Mod 7).Caption, Len(Label2(myord Mod 7).Caption) - 1)

Text1(myord Mod 7).SelStart = myend - 1 'jjjjjjjjjjjjjjjjjjjj
Else
a:
delete = 0
End If
End Sub

。。。其它代码不公开,但本人愿意提供关键处代码,以代参考,或者思路问题进行回答!请加本人的QQ:599299169

Dim s$, t%
Private Sub Command1_Click()
Dim a%
For i = 1 To 50
a = Int(Rnd * 26 + 65)
s = s + UCase(Chr(a))
Next
Text1 = s
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub

Private Sub Form_Load()
Timer1.Interval = 1000
Text1 = "": Text2 = "": Text3 = "": Text4 = ""
End Sub

Private Sub Text2_Click()
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
Static p!, sum%, m%
t = t + 1
Text3 = t
m = Len(Text2)
sum = 0
For i = 1 To m
If Mid(Text2, i, 1) = Mid(s, i, 1) Then
sum = sum + 1
p = sum / m
Text4 = p * 100 & "%"
End If
Next
End Sub




以下程序运行的结果是 。 #include<stdio.h> #include
include<stdio.h>#include<string.h>\/\/=== 函数部分=== fun(char *w, int n){ char t,*s1,*s2; \/\/定义字符t,字符指针s1,s2 s1=w; s2=w+n-1; \/\/将上面的指针p赋予指针s1,s2是在s1右移7-1=6 实际*s2='7' while(s1<s2) \/\/当s1指向的地址,少于s2指向的地址时【...

推荐一款练习打字的软件
五笔编码查寻程序是一个可查86版五笔和98版五笔输入法编码的程序,还可以用拼音来查寻,也可以反查一个汉字的拼音,是五笔使用者的必备工具。软件名称:五笔打字通 [国产]软件授权:共享软件使用平台:Win9X\/Me\/NT\/2000\/XP软件开发:HomePage软件简介:五笔打字通是一款专为五笔学习的朋友设计的练习软件,它跟市面的上其它...

求c语言英文打字练习程序
#define ESC 0x011b \/* 退出程序键,调用quitgame()函数*\/#define F1 0x3b00 \/* 查看帮助信息,调用Help()函数 *\/#define F2 0x3c00 \/* 查看...if(ch=='n'||ch=='N') \/*判断是否练习打字*\/ { quitgame(); break; } else if(ch=='y'||ch=='Y') { Typing(); break; } }}void ...

Excel表格基本操作?
excel表格基本操作教程如下:Excel表格的基本操作一:修改字体首先,从输入开始,先来调整字体吧。在工具栏那里一开始就可以发现字体的工具框了,在这里可以快速更改字体类型、大小、颜色等等的。Excel表格的基本操作二:更改对齐方式打好字,或者打字之前,都需要按照需要来调整字体的对齐方式的。在对齐方式...

不会拼音,怎样快速学会26键拼音打字?
①见字知码:汉字笔形近似于英文字母笔形。例如:丅→ t; 𠂉、丫→ y;氵→ i;丶→ d;丿→ f;亻、人→ h;扌→ j;丨、亅→ l;乂、乄→ x;辶、讠→ c;阝、卩→ b;冂→ m……汉字按结构一分为二,分别取其首部笔形为第1、2码;再取尾部笔形为第3码。例如“...

A,B,C,D,E五名打字员承担一项打字任务,若单独完成,A需56小时,B需42小...
同理可得A+B+C各1小时完成=1\/24+1\/30=3\/20,A+B+C+D各1小时完成3\/20+1\/20=1\/5 A+B+C+D+E各1小时完成1\/5+1\/12=17\/60,3轮过后完成3*17\/60=51\/60,尚余1-51\/60=3\/20,正好可由A+B+C各1小时完成,故如果按ABCDE,ABCDE的顺序轮流打字需3*5+3=18小时完成。(2)如果...

C语言打字游戏vc环境
首先,输入字母的时候,你要解决输入进来,然后不显示在屏幕上;接着,判断这个字母符不符合要求,然后设置字的颜色,并显示,而且播放声音。当字母输入完之后,就计算正常率,符合要求进入下一关,不符合就重来这一关。在游戏过程中,输入一个特定的按键,退出游戏。所以,解决问题:①按键后,界面不显示...

请问用智能A B C 打字时怎样中英文转换谢谢
键盘左下角shift 和ctrl一齐按若转换若转换中英只按ctrl你试一下吧

怎么用电脑学打字最快
编写教材不用愁。 ⑥多国外文:能直接输入日韩等50余种语言涉及136个非英语国家的法定文字和大量图形符号,能在全球大多数国家的网上进行信息检索和交流,而...紫光需要先输入一个大写的B,其他输入一个u就能开始使用笔画输入了,五个笔划对应的第一个声母就是。拼音输入法的优点是显而易见的,上手快,打字快,不容易...

我想用C写一个简单的对照英文打字程序,高手帮我看下是哪里错了,无法通...
支持同步比较:\/***\/ include<stdio.h> include<conio.h> main(){ char k[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};char w[30];int i;printf("abcdefghijklmnopq...

曲周县19696265206: VB编写的打字程序 -
斋咏五子: 我有,当年自己写的一个得过的作品! 功能:运行打错字,回退键重要,打对字实现“打勾”,与打错字“打差”统计正确率,速度,图形界面显示键盘图...(2万行左右代码) Private Sub Text1_Change(Index As Integer) On Error GoTo text1...

曲周县19696265206: 编写一个VB的英文打字练习程序 完整代码 -
斋咏五子: Dim m, s As Double Private Sub Command1_Click() Text2.Text = "" Text1.Text = "" For i = 1 To 30 Text2.Text = Text2.Text & Chr(Int(Rnd * 25 + 66)) Next i Timer1.Enabled = True Timer1.Interval = 1000 m = 0 s = 1 End Sub Private Sub ...

曲周县19696265206: VB 编制打字练习程序.首先单击“产生”,在文本框1随机产生一串大写字母,在文本框2,练打字键入…… -
斋咏五子: Dim s$, t% Private Sub Command1_Click() Dim a% For i = 1 To 50 a = Int(Rnd * 26 + 65) s = s + UCase(Chr(a)) Next Text1 = s End Sub Private Sub Command2_Click() Timer1.Enabled = False End Sub Private Sub Form_Load() Timer1.Interval ...

曲周县19696265206: 英文打字练习的vb程序 -
斋咏五子: '要有两个标签一个按钮和两个时间控件 Dim s As Integer Private Sub Command1_Click() If Command1.Caption = "开始" Then s = 0 Command1.Enabled = False Timer1.Interval = 60000 Timer2.Interval = 10 Label1.Caption = "分数" & s ...

曲周县19696265206: 用vb怎么编一个简单的打字软件, -
斋咏五子: 简单的打字代码,太难的俺不会做:窗体上创建一个text1,用于随机显示20 个字符 text2 用于打字输入 按钮1 :用于产生随机字符 label1 : 用于显示正确率 Option Explicit Private Sub Command1_Click() Dim i As Integer Dim rndNum As Integer ...

曲周县19696265206: vb打字练习应用程序,跪求高手,谢谢了!! -
斋咏五子: Dim RNEWALLSTRING As String '合并字符串,此时的字符串已经不包换换行符和空格Dim ER As IntegerPrivate Sub Command1_Click() '注意len(vbcrlf)=2Timer1.Enabl...

曲周县19696265206: 怎样用vb编写一个自动输入软件 -
斋咏五子: 给你个例子:Private Sub Command1_Click() MsgBox "按下确定后开始运行", vbOKOnly, "提示" Timer1.Interval = CInt(Text2.Text) ''设置速度 Timer1.Enabled = True End Sub Private Sub Timer1_Timer() Static flg As Integer flg = flg + 1 str...

曲周县19696265206: 怎样编写VB程序:英文打字训练的程序 -
斋咏五子: 都不给点分的啊 Dim x As Integer Private Sub Command1_Click() Label2.Caption = "" Text2.Text = "" For i = 1 To 30 Label2 = Label2 & Chr(Int(Rnd() * 26) + 97) Next i End Sub Private Sub Text2_Change() Dim r As Integer If Len(Text2.Text) ...

曲周县19696265206: vb 编程:关于打字程序 -
斋咏五子: 用vb.net来做吧, vb 处理消息不好. vb.net的窗体有专门的消息处理过程,你重写一下他的消息处理过程,处理他的键盘输入就可以了.-------那你就处理窗体的keypress事件,通过那里判断输入的是什么字符.

曲周县19696265206: 用 V B 编写一个打字游戏,就是26个英文字母重上面掉下来,一个一个的字母.我是新手 希望大家多多帮忙 -
斋咏五子: 建立3个label控件1个timer控件1个commandbutton控件 把label1的index属性设置为0 把下面代码复制进去就可以了----------- Dim a() As Integer Dim k% '一次出现多少个字母 Dim s% '速度 Private Sub Command1_Click() Timer1.Enabled = True ...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网