Live Chat Icon For mobile
Live Chat Icon

How do I set the color and font in a RichEditBox

Platform: WinForms| Category: RichTextBox

You use the SelectionFont and SelectionColor properties. Make sure the control had focus. Then the following code will set the currently selected text to a red-bold-courier font. If no text is currently selected, then any new text typed (or inserted) will be red-bold-courier.

[C#]
	richTextBox1.Focus();
	richTextBox1.SelectionColor = Color.Red;
	richTextBox1.SelectionFont = new Font ('Courier', 10, FontStyle.Bold);
[VB.NET]
	richTextBox1.Focus()
	richTextBox1.SelectionColor = Color.Red
	richTextBox1.SelectionFont = new Font ('Courier', 10, FontStyle.Bold)

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.