简单打字练习VB代码
来源:百度知道 编辑:UC知道 时间:2024/05/04 12:33:11
Dim i As Integer '
Dim zheng As Integer '保存输入正确的值
Dim err1 As Integer '保存输入错误的值
Dim timei As Integer
Private Sub Command1_Click()
Dim name As String
With CommonDialog1
.ShowOpen
name = .FileName
End With
RichTextBox1.LoadFile name
ccrpProgressBar1.Max = Len(RichTextBox1.Text)
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
End Sub
Private Sub Form_Load()
ccrpProgressBar1.Max = Len(RichTextBox1.Text)
i = 1
timei = 0
RichTextBox1.SelStart = 3
RichTextBox1.SelColor = vbRed
End Sub
Private Sub Text1_Change()
If Len(Text1.Text) <> 0 Then
If Mid(RichTextBox1.Text, Len(Text1.Text), 1) = Mid(Text1.Text, Len(Text1.Text), 1) Then
RichTextBox1.SelStart = i - 1
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbBlue