------ToolStrip
其中每个按钮的属性(设置Tag等),其事件为


private void SetStyle(object sender,EventArgs e)
{
ToolStripButton btn = sender as ToolStripButton;
FontStyle fontStyleContent = this.rchTxtContent.SelectionFont.Style;
FontStyle BtnFont = ( FontStyle)(Enum.Parse(typeof(FontStyle),btn.Tag.ToString()));
if ((fontStyleContent | BtnFont) == fontStyleContent)
{
fontStyleContent = ~BtnFont & fontStyleContent;
}
else
{
fontStyleContent = fontStyleContent | BtnFont;
}
this.rchTxtContent.SelectionFont = new Font(
this.rchTxtContent.SelectionFont.FontFamily,
this.rchTxtContent.SelectionFont.Size,
fontStyleContent,
this.rchTxtContent.SelectionFont.Unit
);
}
源代码下载地址:https://files.cnblogs.com/beniao/enumExample.rar