richtextbox2.text的属性里是正确的汉字
richtextbox3.text的属性里是我们要打的字
用这两个控件的text属性作比较,正确的用蓝色显示,错误的用红色显示Private Sub RichTextBox3_Change() Dim str1$, str2$, L%, l2%
Static i, l1 As Integer
RichTextBox3.SelLength = 1
l2 = Len(RichTextBox3.Text)
i = i + 1 '起始位置
L = l2 - l1 '取字符串长度
str1 = Mid(RichTextBox2.Text, i, L)
str2 = Mid(RichTextBox3.Text, i, L)
l1 = l2 '把上一个字符串长度给变量l1
i = i + L - 1 '确定下一个字符串的起始位置
RichTextBox3.SelStart = RichTextBox3.SelStart + 1
If str2 <> str1 Then
RichTextBox3.SelColor = RGB(255, 0, 0)
Else
RichTextBox3.SelColor = RGB(0, 0, 255)
End If
End Sub
正确与否,我能判断出来,颜色为什么不能正确显示呀!
那位高手给指教一下!帮我改改代码,万分的感谢!
richtextbox3.text的属性里是我们要打的字
用这两个控件的text属性作比较,正确的用蓝色显示,错误的用红色显示Private Sub RichTextBox3_Change() Dim str1$, str2$, L%, l2%
Static i, l1 As Integer
RichTextBox3.SelLength = 1
l2 = Len(RichTextBox3.Text)
i = i + 1 '起始位置
L = l2 - l1 '取字符串长度
str1 = Mid(RichTextBox2.Text, i, L)
str2 = Mid(RichTextBox3.Text, i, L)
l1 = l2 '把上一个字符串长度给变量l1
i = i + L - 1 '确定下一个字符串的起始位置
RichTextBox3.SelStart = RichTextBox3.SelStart + 1
If str2 <> str1 Then
RichTextBox3.SelColor = RGB(255, 0, 0)
Else
RichTextBox3.SelColor = RGB(0, 0, 255)
End If
End Sub
正确与否,我能判断出来,颜色为什么不能正确显示呀!
那位高手给指教一下!帮我改改代码,万分的感谢!
解决方案 »
- INI配置文件,如果我配置文件丢失,或者换一台电脑运行,没有此路径。如何避免这些情况
- 那位大哥遇见过,双核机器中VB6 timer 变慢!
- 用winsock发送数据,使用163上网,收到文件不完整.
- 使用mscomm控件,如何判断机器有几个串口
- 有没有什么方法可以得到主板上的cpu的温度和风扇的转速? 在线等
- 如何避免出现:"当系统后台繁忙时,按任意键会弹出"this action cannot be completed because the other application is busy……“的英文
- 用MMControl的问题.
- lihonggen0
- 系统设计
- PDF文件存到数据库中,提出来重新生成PDF文件,用Adobe Acrobat打不开了!!
- 偶家的小可爱^o^——小羽GG和小蝶MM。。。恩爱的一对小宝宝。。。
- 像素的替换问题
Private Sub richtextbox3_Change()
If richtextbox3.Text <> richtextbox2.Text Then
richtextbox3.ForeColor = RGB(255, 0, 0)
Else
richtextbox3.ForeColor = RGB(0, 0, 255)
End If
End Sub
.SelLength=1
Dim selStr1 As String
Dim selStr2 As String
Dim selleng1 As Long
If Not RichTextBox2.SelStart = 0 Then
RichTextBox1.SelStart = RichTextBox2.SelStart - 1
selleng1 = RichTextBox1.SelStart
End If
RichTextBox1.SelLength = 1
selStr1 = RichTextBox1.SelText
RichTextBox2.SelStart = selleng1
RichTextBox2.SelLength = 1
selStr2 = RichTextBox2.SelText
If selStr1 = selStr2 Then
RichTextBox2.SelColor = RGB(0, 0, 0)
Else
RichTextBox2.SelStart = selleng1
RichTextBox2.SelLength = 1
RichTextBox2.SelColor = RGB(0, 0, 255)
End If
RichTextBox2.SelStart = selleng1 + 1
End Sub