Tuesday, 15 April 2014

List of all installed fonts on a computer

-> First of all start visual studio 2008, 2010, 2012 etc.
-> Click on windows form application 
-> Name the new form load installed fonts (or whatever you want).
-> Add 1 listBox and 1 Button from Toolbox.
     or 
-> Design your form as bellow.



















-> Add a reference to the System.Drawing.Text namespace as highlight bellow:

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

using System.Drawing.Text;

-> Now double click the export to excel 2007 button and write the following code
Code for Load listBox Button
       InstalledFontCollection fonts = new InstalledFontCollection();
            try
            {
                foreach (FontFamily fontnames in fonts.Families)
                {
                    listBox1.Items.Add(fontnames.Name);
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }     
The InstalledFontCollection class defines a class that represents the fonts installed on the system.
-> Run Your Program.


Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 comments:

Post a Comment