VB中的Rich TextBox控件中如何使第三个字显示红色
展开全部
简单的:
Private Sub Command1_Click()
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbRed
End Sub
更人性化的:
Private Sub Command1_Click()
Dim MySelStart As Integer, MySelLength As Integer
'绝昌记录RichTextBox的光标位置和选定长度
MySelStart = RichTextBox1.SelStart
MySelLength = RichTextBox1.SelLength
'选定第三个字符,并且竖宏察颜色设为红色余茄
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbRed
'恢复之前的光标位置和选定长度
RichTextBox1.SelStart = MySelStart
RichTextBox1.SelLength = MySelLength
End Sub
Private Sub Command1_Click()
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbRed
End Sub
更人性化的:
Private Sub Command1_Click()
Dim MySelStart As Integer, MySelLength As Integer
'绝昌记录RichTextBox的光标位置和选定长度
MySelStart = RichTextBox1.SelStart
MySelLength = RichTextBox1.SelLength
'选定第三个字符,并且竖宏察颜色设为红色余茄
RichTextBox1.SelStart = 2
RichTextBox1.SelLength = 1
RichTextBox1.SelColor = vbRed
'恢复之前的光标位置和选定长度
RichTextBox1.SelStart = MySelStart
RichTextBox1.SelLength = MySelLength
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询