Retrieve fonts installed on the system

Description:
About Classes used –
#1: An object of InstalledFontCollection class looks for fonts installed in Windows before the object is created.
#2:  This FontFamilyclass encapsulates a set of fonts that make up a font family.
A font family is a group of fonts that have the same typeface but different styles.
         
Here I implemented the Code for retrieving the fonts installed on the System.
           
The Code:
1. Put the following code at OnClick Event of the Combobox control to fetch the fonts into it.
           
private void cbSelectFont_Click(objectsender, EventArgs e)
      {
      //retrieves fonts collection on the system
      using (InstalledFontCollectionff = new InstalledFontCollection())
      {
            foreach (FontFamily item inff.Families) //retrieves font families
            { cbSelectFont.Items.Add(item.Name.ToString()); }
      }
        }
Listing 1
   
2. (Optional) Now you can apply these fonts for other control(s) also. (Here I used it for a Label Control)
3. Now execute the Application and see the result (Figure 1).
         
Intended Result:
Figure 1
Summary:
          In this piece of writing, we have seen how to retrieve the installed fonts of the system using C# Language.
Regards,
Mayur Dighe
http://ImmortalDotNet.blogspot.com
http://MayurDighe.wordpress.com