Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

richTextBox text color change

Status
Not open for further replies.

kokon

Programmer
Apr 27, 2006
31
0
0
PL
Can somebody help me set the color priority of richtextbox to write one line in red color and the next one in for example blue. I tried:
------
richTextBox1.ForeColor = Color.Red;
richTextBox1.Text = "hey";
richTextBox1.ForeColor = Color.Blue;
richTextBox1.Text = "bye";
---------
But it change every lines.
 
Code:
richTextBox1.SelectionStart = 4;
richTextBox1.SelectionLength = 5;
richTextBox1.SelectionColor = Color.Red;richTextBox1.SelectionStart = 10;
richTextBox1.SelectionLength = 5;
richTextBox1.SelectionColor = Color.Blue;


mr s. <;)

 
amazingly, c# will cope with this, but there should, of course, be a newline after the semicolon on line three.

[blush]

mr s. <;)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top