增加2个check控件、1个RichTextBox控件,实现的是与1或者与2中有相同的就红色
Private Sub RichTextBox1_Change()
If Check1.Value = 1 Then
Select Case Right(RichTextBox1.Text, 2)
Case 12, 34, 24, 45, 30, 38, 44, 21
RichTextBox1.SelStart = Len(RichTextBox1.Text) - 2
RichTextBox1.SelLength = 2
RichTextBox1.SelColor = vbRed
RichTextBox1.SelStart = Len(RichTextBox1.Text)
Case Else
RichTextBox1.SelColor = vbBlack
End Select
End If
If Check2.Value = 1 Then
Select Case Right(RichTextBox1.Text, 2)
Case 46, 12, 34, 39, 36, 25, 39, 20
RichTextBox1.SelStart = Len(RichTextBox1.Text) - 2
RichTextBox1.SelLength = 2
RichTextBox1.SelColor = vbRed
RichTextBox1.SelStart = Len(RichTextBox1.Text)
Case Else
RichTextBox1.SelColor = vbBlack
End Select
End If
End Sub
[此贴子已经被作者于2018-5-4 09:29编辑过]