我已经知道如何更改字体:
private void toolStripButton2_Click(object sender, EventArgs e)//italic
{
//maintext is the richTextBox
maintext.SelectionFont = new Font(maintext.Font, FontStyle.Italic);
maintext.SelectionStart = maintext.SelectionStart + maintext.SelectionLength;
maintext.SelectionLength = 0;
maintext.SelectionFont = maintext.Font;
}
但是如何同时允许两种字体,并使字体恢复正常?而且这样您就不必先输入文本然后再选择它;只需按下按钮。