List Fonts : FontFamilies : Graphics C# Source Code


Custom Search

C# Source Code » Graphics » FontFamilies »

 

List Fonts








    
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Text;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form {
    public Form1() {
        this.BackColor = Color.White;
    }
    protected override void OnPaint(PaintEventArgs e) {
        int verticalCoordinate = 10;
        Point topLeftCorner;
        InstalledFontCollection insFont = new InstalledFontCollection();
        FontFamily[] families = insFont.Families;
        e.Graphics.TranslateTransform(AutoScrollPosition.X,AutoScrollPosition.Y);
        foreach (FontFamily family in families) {
            if (family.IsStyleAvailable(FontStyle.Regular)) {
                Font f = new Font(family.Name, 10);
                topLeftCorner = new Point(10, verticalCoordinate);
                verticalCoordinate += f.Height;
                e.Graphics.DrawString(family.Name, f, Brushes.Black, topLeftCorner);
                f.Dispose();
            }
        }
    }
    public static void Main() {
        Application.Run(new Form1());
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Graphics
» FontFamilies