| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 840 人关注过本帖
标题:求教vn.net 中文打字怎么做?
只看楼主 加入收藏
美女
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2005-10-5
收藏
 问题点数:0 回复次数:0 
求教vn.net 中文打字怎么做?

这是个一段英文打字的代码.可我不知道怎么样才能实现中文打字的效果.哪位哥哥姐姐知道教教我啊.谢谢.我的QQ543958475 知道的请加我QQ教我好吗?谢谢了 Dim lbsource(5) As Label '文字提示内容 Dim lbinput(5) As Label '文字录入内容 Dim csource(300) As Char Dim cinput(300) As Char Dim str As String Dim icorrect, inum, isecond As Integer Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load lbsource(1) = Label1 lbsource(2) = Label3 lbsource(3) = Label5 lbsource(4) = Label7 lbsource(5) = Label9 lbinput(1) = Label2 lbinput(2) = Label4 lbinput(3) = Label6 lbinput(4) = Label8 lbinput(5) = Label10 Dim i As Integer For i = 1 To 5 lbsource(i).Visible = False lbinput(i).Visible = False Next Lbstart.Visible = False End Sub Sub openrnd() ReDim csource(300) Dim i As Integer For i = 1 To 300 If i Mod 6 = 0 Then csource(i) = " " Else csource(i) = Chr(Int(Rnd() * 26 + 97)) End If lbsource((i - 1) \ 60 + 1).Text = lbsource((i - 1) \ 60 + 1).Text & csource(i) Next End Sub

Private Sub ToolBar1_ButtonClick(ByVal sender As Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick Select Case ToolBar1.Buttons.IndexOf(e.Button) Case 0 Lbstart.Visible = True Lbstart.Focus() Dim i As Integer For i = 1 To 5 lbsource(i).Visible = True lbsource(i).Text = "" lbinput(i).Visible = True lbinput(i).Text = "" Next openrnd() Case 1 Lbstart.Visible = True Dim j As Integer For j = 1 To 5 lbsource(j).Visible = True lbsource(j).Text = "" lbinput(j).Visible = True lbinput(j).Text = "" Next opentxt() End Select End Sub

Sub opentxt() ReDim csource(300) OpenFileDialog1.Filter = "文本文件(*.txt)|*.txt" If OpenFileDialog1.ShowDialog = DialogResult.OK Then FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) Do Until EOF(1) str = str & LineInput(1) If str.Length > 300 Then Exit Do End If Loop Do Until str.Length > 300 str = str & str Loop FileClose(1) csource = str.Substring(0, 300).ToCharArray Dim i As Integer For i = 1 To 300 lbsource((i - 1) \ 60 + 1).Text = lbsource((i - 1) \ 60 + 1).Text & csource(i - 1) Next End If Lbstart.Focus() End Sub

Private Sub Lbstart_keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Lbstart.KeyPress If e.KeyChar = Chr(13) Then Lbstart.Visible = False lbpreformat.Visible = False Panel1.Focus() Timer1.Enabled = True End If

End Sub

Private Sub Panel1_keypress(ByVal sender As Object, ByVal e As System.windows.Forms.KeyPressEventArgs) Handles Panel1.KeyPress Static i As Integer = 1 If i < 301 Then If e.KeyChar = Chr(13) Then cinput(i) = " " Else cinput(i) = e.KeyChar End If lbinput((i - 1) \ 60 + 1).Text = lbinput((i - 1) \ 60 + 1).Text & cinput(i)

If cinput(i) = csource(i) Then icorrect = icorrect + 1 End If i = i + 1 inum = inum + 1 End If If inum = 300 Then Timer1.Enabled = False End If

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick isecond = isecond + 1 lbpreformat.Visible = True lbpreformat.Text = "正确率:" & icorrect & "/" & inum & "你用了" & isecond & "秒" End Sub End Class

搜索更多相关主题的帖子: 中文 打字 
2005-10-05 14:38
快速回复:求教vn.net 中文打字怎么做?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016177 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved