

























visual basic code:
Dim iPos As Long
Dim strInsert As String
Dim strRTF As String
Dim lStart As Long
'assumes that strInsert contains the RTF code that you want to insert
'and that the current cursor position is where you want it selected
With RichTextBox1
'mark the current insertion point with special characters
.SelText = Chr(&H9D) & Chr(&H81)
'get the rtf text into our variable
strRTF = .TextRTF
'insert our text at the insertion point
strRTF = Replace(.TextRTF, "\'9d", strInsert)
.TextRTF = strRTF
'now find the end of the insertion
lStart = .Find(Chr(&H81))
'get rid of the other character
strRTF = Replace(.TextRTF, "\'81", "")
.TextRTF = strRTF
'position the cursor after the insertion
.SelStart = lStart
End With
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。