|
-
Apr 25th, 2010, 01:16 PM
#1
Thread Starter
Lively Member
Change Text Color in Code
Hi Guys,
So I have a RichTextBox for a Chat, And I was just wonder how i can change the color of the text in the code. I know you can change the foreground color in the application its self, but I need to change the color IN THE CODE. Please let me know how. Thanks guys :-)
-
Apr 25th, 2010, 01:22 PM
#2
Addicted Member
Re: Change Text Color in Code
If I understand you correctly, this is what you are looking for:
Code:
RTB.ForeColor = Color.Red
-
Apr 25th, 2010, 01:24 PM
#3
Thread Starter
Lively Member
Re: Change Text Color in Code
Now How can i apply that to the text.
For Example
RichTextBox1.AppendText("<System>" & TimeOfDay & vbCrLf)
How could i change the color of <System> to Red
-
Apr 25th, 2010, 01:27 PM
#4
Addicted Member
Re: Change Text Color in Code
Here's a quick way of doing it, but mind you, It's thrown together, and not particularly effective.
Code:
RichTextBox1.AppendText("<System>" & TimeOfDay & vbCrLf)
RichTextBox1.Select(RichTextBox1.TextLength - ("<System>" & TimeOfDay & vbCrLf).Length + 1, ("<System>" & TimeOfDay & vbCrLf).Length - 1)
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.DeselectAll()
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
|