zoukankan      html  css  js  c++  java
  • WinForm绘制文本--字体加粗、倾斜、下划线

         Graphics g;
            Font font;
            Brush brush;
            string fontString = "";
            private void button1_Click(object sender, EventArgs e)
            {
                //宋体,14号,蓝色,正常
                g = this.CreateGraphics();
                font = new Font("宋体", 14);
                brush = new SolidBrush(Color.Blue);
                fontString = "宋体,14号,蓝色,正常";
                g.DrawString(fontString, font, brush, 20, 10);
    
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                //宋体,14号,红色,加粗
                g = this.CreateGraphics();
                font = new Font("宋体", 14,FontStyle.Bold);
                brush = new SolidBrush(Color.Red);
                fontString = "宋体,14号,红色,加粗";
                g.DrawString(fontString, font, brush, 20, 50);
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                //隶书,16号,绿色,有下划线
                g = this.CreateGraphics();
                font = new Font("隶书", 16,FontStyle.Underline);
                brush = new SolidBrush(Color.Green);
                fontString = "隶书,16号,绿色,有下划线";
                g.DrawString(fontString, font, brush, 20, 90);
            }
    
            private void button4_Click(object sender, EventArgs e)
            {
                //黑体,20号,灰色,倾斜
                g = this.CreateGraphics();
                font = new Font("黑体", 20,FontStyle.Italic);
                brush = new SolidBrush(Color.Blue);
                fontString = "黑体,20号,灰色,倾斜";
                g.DrawString(fontString, font, brush, 20, 130);
            }
  • 相关阅读:
    [每周心学]先生王阳明何许人也?
    CET-6 分频周计划生词筛选(番外篇:百词斩)
    CET-6 分频周计划生词筛选(Week 3)
    架构之美阅读笔记三
    架构之美阅读笔记二
    架构之美阅读笔记一
    软件需求分析课堂讨论01
    问题账户需求分析
    2016年秋季个人阅读计划
    个人总结
  • 原文地址:https://www.cnblogs.com/zyadmin/p/8406110.html
Copyright © 2011-2022 走看看