|
-
Mar 27th, 2000, 07:38 AM
#1
Thread Starter
Junior Member
I'm sure its simple but can somebody help me out? I'm making an internet chatting program which works very good so far, but i wanna add color and diffrent sizes to the text in the chat but i cant figure out how to combine the rich text formats. (lots of q's today i guess...no more right now tho...)can somebody help me out id be like really grateful
thanx,
matt
-
Mar 27th, 2000, 07:47 AM
#2
Hyperactive Member
Not exactly sure what you are asking here...
If you are talking about adding the contents of one rich text box to that of another you should use the TextRTF attribute.
Code:
richtextbox1.TextRTF = richtextbox1.TextRTF & richtextbox2.RTF
Basically the contents of the rich text box are stored as pure ascii under "richtextbox.Text" and with formatting included in "richtextbox.TextRTF".
-
Mar 27th, 2000, 07:59 AM
#3
Thread Starter
Junior Member
ur helping me alot man...
but thats the same thing i tried this morning...and it wont work...i dont know whats wrong...i was taking a look at the rtf tags themselves and the only way i could get it to combine the strings at all was removing all the second strings formating and taking the } off the end of the last paragraph of the first string...maybe im doing something wrong i dunno...if ur busy and im being annoying u dont haveta answer man ill figure it out eventually
-
Mar 27th, 2000, 08:13 AM
#4
Hyperactive Member
Nah thats ok... I have the occasional bit of free time.
I think you are having a fight with the RTF protocol. It is designed such that it encapsulates all the text so you are right when you say that adding the second one to the end doesn't help.
What you need to do is work out the RTF format enough to be able to parse the TextRTF string, cut out all the duplications (There appears to be a part of a header in there) and then only append the sections containing the text to the appropriate part within the other one.
Its long and its hard... dont envy you there.
But I have found places on the Net that explain the RTF format in detail... you might want to run it through a few search engines.
-
Mar 27th, 2000, 08:17 AM
#5
Thread Starter
Junior Member
thanx man i didnt think i was going nuts
i guess there arent any easy solutions as far as this one...real work...oh well...i guess i better get used to it...lol...just trying to stumble through teaching myself new stuff and still have time school and life and all that other stuff...well thanx for all ur help man
peace
-
Sep 28th, 2001, 09:33 AM
#6
New Member
Another way to combine RTFs
Another way to solve the problem is to create a scratch RTF area and let that object do the combination work for you. The example below places a header followed by chat data into a scratch RTF area and then saves the combined information into a file (note: the rtbScratchArea has Visible=False):
Dim intFileNo As Long
rtbScratchArea.Text = ""
rtbScratchArea.SelStart = 0
rtbScratchArea.SelColor = &HFF00
rtbScratchArea.SelBold = 1
rtbScratchArea.SelText = "Header:" & vbCrLf
rtbScratchArea.SelStart = Len(rtbScratchArea.Text)
rtbScratchArea.SelRTF = rtbHeader.TextRTF
rtbScratchArea.SelStart = Len(rtbScratchArea.Text)
rtbScratchArea.SelColor = &HFF00
rtbScratchArea.SelBold = 1
rtbScratchArea.SelText = vbCrLf & "Chat:" & vbCrLf
rtbScratchArea.SelStart = Len(rtbScratchArea.Text)
rtbScratchArea.SelRTF = rtbChatArea.TextRTF
intFileNo = FreeFile
Open dlgCommon.FileName For Output As #intFileNo
Print #intFileNo, rtbScratchArea.TextRTF
Close #intFileNo
Enjoy!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|