CSharp examples for System.Windows.Forms:RichTextBox
Append Text to RichTextBox with color
public class Main{ //for RichTextBox public static void AppendText(this System.Windows.Forms.RichTextBox rtb, string text, System.Drawing.Color color) {//from www . j a v a 2 s . c o m int start = rtb.TextLength; rtb.AppendText(text); int end = rtb.TextLength; // Textbox may transform chars, so (end-start) != text.Length rtb.Select(start, end - start); { rtb.SelectionColor = color; // could set box.SelectionBackColor, box.SelectionFont too. } rtb.SelectionLength = 0; // clear } }