

Text1.Text = Text1.Text & strMyString & vbCrLf


Text1.SelStart = Len(Text1.Text)
Text1.SelLength = 0
Text1.SelText = "abc"
' Text1.SelStart = Len(Text1.Text)
Text1.SelStart = 1000000 ' или другая большая константа, помещающаяся в Long
Text1.SelText = "abc"

Public Type char
cChar As String * 1
cColor As Long
cBold As Boolean
cItalic As Boolean
cUnderln As Boolean
End Type
...........
Sub WriteToChannel(chName As String, str)
Dim b As Boolean, i As Boolean, u As Boolean, c As Long
Dim cr As Byte, cg As Byte, cb As Byte
Dim k As Integer
Dim chArr() As char
Dim iChannelID As Integer
' поиск формы нужного канала
For k = 0 To UBound(ChatForms)
If Not ChatForms(k) Is Nothing Then
If Trim$(ChatForms(k).Tag) = Trim$(chName) Then
iChannelID = k
Exit For
End If
End If
Next k
c = RGB(0, 0, 0)
b = False
i = False
u = False
On Error Resume Next
Do While Len(str) > 0
ReDim Preserve chArr(k)
If Mid$(str, 1, 3) = "[b]" Then
b = True
str = Mid$(str, 4)
GoTo cont
End If
If Mid$(str, 1, 4) = "[/b]" Then
b = False
str = Mid$(str, 5)
GoTo cont
End If
If Mid$(str, 1, 3) = "[u]" Then
u = True
str = Mid$(str, 4)
GoTo cont
End If
If Mid$(str, 1, 4) = "[/u]" Then
u = False
str = Mid$(str, 5)
GoTo cont
End If
If Mid$(str, 1, 3) = "[i]" Then
i = True
str = Mid$(str, 4)
GoTo cont
End If
If Mid$(str, 1, 4) = "[/i]" Then
i = False
str = Mid$(str, 5)
GoTo cont
End If
If Mid$(str, 1, 2) = "[c" Then
cr = CByte(Val(Mid$(str, 4, 3)))
cg = CByte(Val(Mid$(str, 8, 3)))
cb = CByte(Val(Mid$(str, 12, 3)))
c = RGB(cr, cg, cb)
str = Mid$(str, 16)
GoTo cont
End If
If Mid$(str, 1, 4) = "[/c]" Then
c = vbBlack
str = Mid$(str, 5)
GoTo cont
End If
If Mid$(str, 1, 2) = "[]" Then
b = False
i = False
u = False
c = vbBlack
str = Mid$(str, 3)
GoTo cont
End If
chArr(k).cChar = Mid$(str, 1, 1)
With chArr(k)
.cBold = b
.cColor = c
.cItalic = i
.cUnderln = u
End With
str = Mid$(str, 2)
k = k + 1
cont:
Loop
For k = 0 To UBound(chArr)
With ChatForms(iChannelID).rtfText
.SelBold = chArr(k).cBold
.SelItalic = chArr(k).cItalic
.SelUnderline = chArr(k).cUnderln
.SelColor = chArr(k).cColor
.SelText = chArr(k).cChar
End With
Next k
ChatForms(iChannelID).rtfText.SelBold = False
ChatForms(iChannelID).rtfText.SelItalic = False
ChatForms(iChannelID).rtfText.SelUnderline = False
ChatForms(iChannelID).rtfText.SelColor = vbBlack
ChatForms(iChannelID).rtfText.SelText = vbCrLf
ChatForms(iChannelID).rtfText.SelStart = Len(ChatForms(iChannelID).rtfText.Text)
End Sub
Сейчас этот форум просматривают: AhrefsBot, SemrushBot и гости: 10