# 可以了!!

Posted by Jerry on February 03, 1998 at 23:14:14:

In Reply to: SelText 属性 posted by 小吴 on February 03, 1998 at 17:26:46:

: 既然你都知道要用 SelXXX 属性，那为什么忘了用 SelText 属性呢?看看下面的例子，应该就是你要的结果。

: With RichTextBox1
: 　.SelColor = QBColor(Int(Rnd * 16))
: 　.SelText = "Abcd"
: End With
感谢您给的提示, 问题已解决, 我是这样做的:

Private Sub Text1_KeyPress(KeyAscii As Integer)
Static coo As Integer
If KeyAscii = 13 Then
rtxt.SelStart = maxi
rtxt.SelText = Text1.Text & Chr(10) & Chr(12)
rtxt.SelLength = Len(Text1.Text)
rtxt.SelColor = QBColor(coo)
maxi = maxi + Len(Text1.Text) + 2
Text1.Text = ""
coo = coo + 1
If coo > 16 Then coo = 0
End If
End Sub

Follow Ups: