FontFamily.Families Property

Returns an array that contains all the FontFamily objects associated with the current graphics context.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public static FontFamily[] Families { get; }
/** @property */
public static FontFamily[] get_Families ()

public static function get Families () : FontFamily[]

Not applicable.

Property Value

An array of FontFamily objects associated with the current graphics context.

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 Millennium Edition, 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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: