|
-
Oct 21st, 2006, 10:55 AM
#1
Thread Starter
PowerPoster
RTB issue
coloring and insertion of text! Something struck me.
Now, if I have text in the RTB and I want to color it, then insert more text at the end, the last color set gets used to write the new text, even if I change the color after selecting the color of the text to color.
Code:
this.richTextBox1.SelectionStart = 0;
this.richTextBox1.SelectionLength = this.richTextBox1.Text.Length;
this.richTextBox1.SelectionColor = Color.Blue;
this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
this.richTextBox1.SelectionLength = 0;
this.richTextBox1.SelectionColor = Color.Black;
this.richTextBox1.Text += "new text here";
however if I replace the last line with .AppendText(), it works great!
Question: why?
next Q: if I wanted to insert text, again with a specific color, to the text already, how would I do this without changing the text color of the existing text in the RTB control?
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
|