C#设置字体斜体,粗体,下划线,要求可以同时执行粗体斜体下划线3种效果,并且再次点击效果会消失,代码
2015-06-22
现学现卖,这样可行?
button Click代码
private void button1_Click(object sender, EventArgs e)
{
if (button1.Font.Bold == false && button1.Font.Italic == false && button1.Font.Underline == false)
{
button1.Font = new System.Drawing.Font("宋体", 9f, ((System.Drawing.FontStyle)(((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic)
| System.Drawing.FontStyle.Underline))));
}
else
{
button1.Font = new System.Drawing.Font("宋体", 9f);
}
}