日期:2014-05-17 浏览次数:20910 次
private void buttonBold_Click(object sender, EventArgs e)
{
Font oldFont, newFont;
oldFont = this.RichTextBox.SelectionFont;//获取旧字体
try
{
if (oldFont.Bold)
{ newFont = new Font(oldFont, oldFont.Style & ~FontStyle.Bold); }
else
{
newFont = new Font(oldFont, oldFont.Style | FontStyle.Bold);
}
this.RichTextBox.SelectionFont = newFont;
this.RichTextBox.Focus();
}
catch (System.NullReferenceException E)
{
MessageBox.Show(E.Message);
}
catch
{
MessageBox.Show("......");
}
}