This class is a collection of storing all the installed fonts and enables you to populate them via iteration.
To get all the installed fonts, we need first add a reference to System. Drawing and then importing it into our project using a statement.
using System.Drawing.Text;
This will let us use the InstalledFontCollection class.
Now let's build a sample.
Create a Windows form, add a list box, and then add these codes.
using (InstalledFontCollection col = new InstalledFontCollection())
{
foreach (FontFamily fa in col.Families)
{
listBox1.Items.Add(fa.Name);
}
}
After we run, we'll be populating them.
Hope that helps!