C# – RichTextBox specific colors per few characters / lines C#

ccolorsformattingrichtextbox

I have richTextBox1, and here is the contents:

line one from my textbox is this, and i want this to be normal, arial, 8 point non-bold font

line two, i want everything after the | to be bolded… | this is bold

line three: everything in brackets i (want) to be the color (Red)

line 4 is "this line is going to be /slanted/ or with italics

and so on, basically if I know how to do what I mentioned above, I'll know everything I need to know to complete my project. Code examples would be very very much appreciated! 🙂

Best Answer

You have to set SelectionStart and SelectionLength to specify the text that you want to modify, and then set SelectionColor and SelectionFont to modify the selected text.

http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextbox_members.aspx

Related Topic