I apply a FontStyle Bold on a text selected with a button but I can't go back to the default value when I click on it again I would like that when I click the first time, the FontStyle Bold is applied and when I click again, the FontStyle Regular is applied. Could someone please help me?
private void button3_Click(object sender, EventArgs e)
{
System.Drawing.Font bold = richTextBox1.SelectionFont;
System.Drawing.FontStyle noBold;
if (richTextBox1.SelectionFont.Bold == true)
{
noBold = FontStyle.Regular;
}
else
{
noBold = FontStyle.Bold;
}
richTextBox1.SelectionFont = new Font(richTextBox1.Font.FontFamily, richTextBox1.Font.Size, noBold);
}