Draw Font Families : Font : Drawing 2D C# Examples


C# Examples » Drawing 2D » Font »

 

Draw Font Families








    
using  System;
using  System.Drawing;
using  System.Windows.Forms;

public  class  DrawFontFamilies  :  Form
{
    public  DrawFontFamilies()
    {
        Size  =  new  Size(350,200);
    }
    protected  override  void  OnPaint(PaintEventArgs  e)
    {
        base.OnPaint(e);
        float  x=  10;
        float  y=  10;
        Font  fnt;
        Graphics  g  =  e.Graphics;

        FontFamily[]  ffArray  =  FontFamily.Families;
        foreach(  FontFamily  ff  in  ffArray  )
        {
            if  (ff.IsStyleAvailable(FontStyle.Regular))
            {
                fnt  =  new  Font(ff,  10);
                g.DrawString(ff.Name,  fnt,  Brushes.Black,  x,  y);
                Brush  b  =  new  SolidBrush(ForeColor);
                g.DrawString(ff.Name,  fnt,  b,  x,  y);

                y  +=  fnt.GetHeight();
            }
        }
    }
    static  void  Main()  
    {
        Application.Run(new  DrawFontFamilies());
    }
}
    
   
  
   




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Drawing 2D
» Font