|
-
December 2nd, 1998, 09:54 AM
#1
RichText Box
How I can write in a RichTextBox using multiple font color?
Thanks,
AA.Keynia
-
December 2nd, 1998, 11:34 PM
#2
-
December 3rd, 1998, 01:43 AM
#3
Re: RichText Box
Hi,
If you want to change the color of the text in Rich Text Box, first select the text to be changed and use selcolor property. I have added a sample vb code.
Place a richtextbox and change the name property to rt.
Load a text file with word Start# and End#.
The following code will change the contents in between Start# and End# to red color.
Private Sub Form_Load()
startpos = 0
Do While Not flag
rt.SelLength = 0
startpos = rt.Find("START#", startpos)
If startpos = -1 Then flag = True
startpos = startpos + rt.SelLength
rt.SelLength = 0
endpos = rt.Find("END#", startpos)
If endpos = -1 Then flag = True
If Not flag Then
rt.SelStart = startpos
rt.SelLength = endpos - startpos
rt.SelColor = vbRed
End If
startpos = endpos
Loop
End Sub
I hope this code also will help you.
Bye
A. Karthikeyan
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
|