Hello everyone
I would like a richtextbox have multiple colors in it.
To go into more detail:
I want certain tags to be different colors.
Lets says for every string in the richtextbox that is the following text "Pluigin" make it blue.
I want to end up with somthing that looks like visual basics color syntax.
Thanks
Richtextbox Color Syntax Help(VB)
-
- Posts: 45
- Joined: Tue Jun 12, 2007 2:07 pm
ooo i tried this a while ago but never got it to work so i'll be interested if anyone has the answer

Halo 2 Plugins | Lock-on To Just About Anything | My Sites | Snow Hog
Old Plugins you have, upgrade you must...
Always Maintain a High Quality-To-Crap Ratio.
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
![]() |
![]() |
It's very difficult to "explain".. You've basically got to think very logically about it.
To actually change the colour of a piece of text in the richtextbox..
You will notice though that this does actually make the RTB 'flicker', where for a brief moment you see the highlight drawn over the text to be changed. This can be avoided by overriding the RTB and keeping control of when to let it re-paint. There should be something on the internet to help you with that.. just search for 'flicker free RTB' or something.
To actually change the colour of a piece of text in the richtextbox..
Code: Select all
Dim start As Integer = rtb.SelectionStart
Dim length As Integer = rtb.SelectionLength
rtb.SelectionStart = 0 ' Index of start of word
rtb.SelectionLength = 10 ' Length of word
rtb.SelectionColor = Color.DarkRed
rtb.SelectionStart = start
rtb.SelectionLength = length
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
Halo 3 Research Thread - Contribute to the research into Halo 3.
-
- Posts: 45
- Joined: Tue Jun 12, 2007 2:07 pm
For anyone who was interested in this I have found some really useful code.
Here it is:
http://pietschsoft.com/post/2005/05/VBN ... ntrol.aspx
It's so sweet.[/url]
Here it is:
http://pietschsoft.com/post/2005/05/VBN ... ntrol.aspx
It's so sweet.[/url]