您的位置:首页 > Web前端 > CSS

【转载】C# winfrom设置textbox字体大小和样式

2013-12-13 09:11 344 查看
C# winfrom设置textbox字体大小和样式
【转载于】2cto.com/kf/201202/118319.html
private void radioButton1_CheckedChanged(object sender, System.EventArgs e)
   {
    //设置字体为宋体
    textBox1.Font=new Font("宋体",textBox1.Font.Size,textBox1.Font.Style);
   }
 
   private void radioButton4_CheckedChanged(object sender, System.EventArgs e)
   {
    //设置字体的大小为12 www.2cto.com
    textBox1.Font=new Font(textBox1.Font.FontFamily,12,textBox1.Font.Style);
   }
 
   private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
   {
    //设置字体的风格为加粗
    if(checkBox1.Checked)
    textBox1.Font=new Font(textBox1.Font,textBox1.Font.Style|FontStyle.Bold);
    else
    textBox1.Font=new Font(textBox1.Font,textBox1.Font.Style^FontStyle.Bold);
   }
 
   private void checkBox2_CheckedChanged(object sender, System.EventArgs e)
   {
    //设置字体的风格为倾斜
if(checkBox2.Checked)
   textBox1.Font=new Font(textBox1.Font,textBox1.Font.Style|FontStyle.Italic);
else
   textBox1.Font=new Font(textBox1.Font,textBox1.Font.Style^FontStyle.Italic);
  
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: