How to change the font in Richtextbox?

Asked

Viewed 316 times

0

I wonder how I do to edit the font and color of a Richtextbox word in C# And if possible how I do to number the lines.

1 answer

1

To open a window (Dialog) where you can choose the font, you can add a Fontdialog component/object to your form. Suppose the name of the type object FontDialog is called fontDialog1, then you can do something similar:

/*Se esta condição é verdadeira, quer dizer que o usuario clicou OK (escolheu uma font).*/
if(fontDialog1.ShowDialog() == DialogResult.OK)
{
    richTextBox1.Font = fontDialog1.Font;
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.