Fill ComboBox with List of available Fonts
Solution 1:
You can use System.Drawing.FontFamily.Families
to get the available fonts.
List<string> fonts = new List<string>();
foreach (FontFamily font in System.Drawing.FontFamily.Families)
{
fonts.Add(font.Name);
}
// add the fonts to your ComboBox here
Solution 2:
Not sure why we need to foreach
here.
IList<string> fontNames = FontFamily.Families.Select(f => f.Name).ToList();
Solution 3:
Use Installed Font Collection class:
http://msdn.microsoft.com/en-us/library/system.drawing.text.installedfontcollection.aspx
This is alternative and equivalent approach to answer from Zach Johnson.
List<string> fonts = new List<string>();
InstalledFontCollection installedFonts = new InstalledFontCollection();
foreach (FontFamily font in installedFonts.Families)
{
fonts.Add(font.Name);
}