Home > DeveloperSection > Forums > Multi-color TextBox C#
Mark Devid
Mark Devid

Total Post:102

Posted on    November-14-2013 12:56 AM

 C# C# 

 1 Reply(s)
 3665  View(s)
Rate this:
I want show text in textbox in 2 colors, for example 1 line red 2 blue, if I use name.ForeColor = Color.Red; all text change color, but I want that will change only 1 line color.

Pravesh Singh

Total Post:412

Posted on    November-14-2013 1:21 AM

Use a RichTextBox for this:

public static class RichTextBoxExtensions


    public static void AppendText(this RichTextBox box, string text, Color color)


        box.SelectionStart = box.TextLength;

        box.SelectionLength = 0;

        box.SelectionColor = color;


        box.SelectionColor = box.ForeColor;



Don't want to miss updates? Please click the below button!

Follow MindStick