GDI+ 使用窗体默认字体

下面将演示如何使用窗体的默认字体。

 

 

 private void Form1_Paint(object sender, PaintEventArgs e)
        {
            FontFamily ff 
= new FontFamily(GenericFontFamilies.SansSerif);
            Font f 
= new Font(ff, 13, GraphicsUnit.Millimeter);
            Font f1 
= new Font(ff, 13, GraphicsUnit.Point);
            
using (Font f2 = new Font(ff, 23, FontStyle.Strikeout)) 
           {
               Graphics g 
= e.Graphics;
               g.DrawString(
"我的名字是……", f2, Brushes.Blue,20,20);
           }
        }

 

View Code
 private void Form1_Paint(object sender, PaintEventArgs e)
        {
            FontFamily ff 
= new FontFamily(GenericFontFamilies.SansSerif);
            Font f 
= new Font(ff, 13, GraphicsUnit.Millimeter);
            Font f1 
= new Font(ff, 13, GraphicsUnit.Point);
            
using (Font f2 = new Font(ff, 23, FontStyle.Strikeout)) 
           {
               Graphics g 
= e.Graphics;
               g.DrawString(
"我的名字是……"this.Font, Brushes.Blue,20,20);
           }
        }
 

 

posted on 2011-07-29 23:58  wtq  阅读(472)  评论(0编辑  收藏  举报