How To: List The Installed Fonts In Your Machine#

This is a really basic stuff that alot of developers tend to forget(just like me :D)

[C# VERSION]

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Text;
using System.Drawing;

namespace KeithRull.MachineFonts
{
   class Program
   {
      static void Main(string[] args)
      {
         // all the fonts in your machine
         InstalledFontCollection installedFonts = new InstalledFontCollection();
         //iterate thru eachy font
         foreach (FontFamily fontFamily in installedFonts.Families)
         {
            //display the font in the screen
            Console.WriteLine(fontFamily.Name);
         }
         //stop and wait for the user to press a key to exit
         Console.ReadLine();
      }
   }
}

[VB.NET VERSION]

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Drawing.Text
Imports System.Drawing

Namespace KeithRull.MachineFonts
   Class Program
      Shared Sub Main(ByVal args() As String)
         ' all the fonts in your machine
         Dim installedFonts As InstalledFontCollection = New InstalledFontCollection() 
         'iterate thru eachy font
         Dim fontFamily As FontFamily
         For Each fontFamily In installedFonts.Families
            'display the font in the screen
            Console.WriteLine(fontFamily.Name)
         Next
         'stop and wait for the user to press a key to exit
         Console.ReadLine()
      End Sub
   End Class
End Namespace

basic yet useful :)

Wednesday, October 11, 2006 9:28:28 PM (GMT Daylight Time, UTC+01:00) #    Comments [0]  |  Tracked by:
"How To: Creating an ASP.NET Font Viewer" (Keith Rull) [Trackback]
"Buy tramadol." (Diet pill tape worm buy tramadol now.) [Trackback]

 

Comments are closed.
All content © 2010, Keith Rull
On this page
This site
Calendar
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: