FontFamily Class
.NET Framework 2.0
Defines a group of type faces having a similar basic design and certain variations in styles. This class cannot be inherited.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Assembly: System.Drawing (in system.drawing.dll)
The following code example shows all the font families in the Families property of the FontFamily class. This example is designed to be used with a Windows Form. To run this example, add a ListBox named listBox1 to a form and call the PopulateListBoxWithFonts method from the form's constructor.
private void PopulateListBoxWithFonts() { listBox1.Width = 200; listBox1.Location = new Point(40, 120); foreach ( FontFamily oneFontFamily in FontFamily.Families ) { listBox1.Items.Add(oneFontFamily.Name); } }
private void PopulateListBoxWithFonts()
{
listBox1.set_Width(200);
listBox1.set_Location(new Point(40, 120));
//foreach (FontFamily oneFontFamily in FontFamily.Families)
for (int iCtr = 0; iCtr < FontFamily.get_Families().length; iCtr++) {
FontFamily oneFontFamily = FontFamily.get_Families()[iCtr];
listBox1.get_Items().Add(oneFontFamily.get_Name());
}
} //PopulateListBoxWithFonts
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.