VB6.0中RichTextBox判断语法
发布网友
发布时间:2024-10-21 22:01
我来回答
共2个回答
热心网友
时间:2024-10-24 03:30
我也是一个初学者,我想这也许可以用这样来实现
Private Sub RichTextBox1_Change()
Dim a, b, i
If RichTextBox1.SelStart < 4 Then Exit Sub
b = RichTextBox1.SelStart
For i = 1 To 4
RichTextBox1.SelStart = RichTextBox1.SelStart - 1
RichTextBox1.SelLength = 4
Next
If RichTextBox1.SelText = "echo" Then
Do While Asc(RichTextBox1.SelText) <> 13 And RichTextBox1.SelStart <> 0
RichTextBox1.SelStart = RichTextBox1.SelStart - 1
RichTextBox1.SelLength = 4
If RichTextBox1.SelText = "echo" Then
RichTextBox1.SelStart = b
RichTextBox1.SelLength = 0
Exit Sub
End If
Loop
RichTextBox1.SelStart = b - 4
RichTextBox1.SelLength = 4
RichTextBox1.SelBold = True
End If
RichTextBox1.SelStart = b
RichTextBox1.SelLength = 0
RichTextBox1.SelBold = False
End Sub
热心网友
时间:2024-10-24 03:30
Private Sub test(ByVal StrT As String)
If InStr(RichTextBox1.Text, StrT) - 1 >= 0 Then
RichTextBox1.SelStart = InStr(RichTextBox1.Text, StrT) - 1
RichTextBox1.SelLength = Len(StrT)
RichTextBox1.SelBold = True
End If
End Sub
Private Sub RichTextBox1_Change()
Call test("echo")
End Sub