FontFamily.Families Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns an array that contains all the FontFamily objects associated with the current graphics context.
public:
static property cli::array <System::Drawing::FontFamily ^> ^ Families { cli::array <System::Drawing::FontFamily ^> ^ get(); };
public static System.Drawing.FontFamily[] Families { get; }
static member Families : System.Drawing.FontFamily[]
Public Shared ReadOnly Property Families As FontFamily()
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 = Point(40,120);
System::Collections::IEnumerator^ myEnum = FontFamily::Families->GetEnumerator();
while ( myEnum->MoveNext() )
{
FontFamily^ oneFontFamily = safe_cast<FontFamily^>(myEnum->Current);
listBox1->Items->Add( oneFontFamily->Name );
}
}
private void PopulateListBoxWithFonts()
{
listBox1.Width = 200;
listBox1.Location = new Point(40, 120);
foreach ( FontFamily oneFontFamily in FontFamily.Families )
{
listBox1.Items.Add(oneFontFamily.Name);
}
}
Private Sub PopulateListBoxWithFonts()
listBox1.Width = 200
listBox1.Location = New Point(40, 120)
Dim oneFontFamily As FontFamily
For Each oneFontFamily In FontFamily.Families
listBox1.Items.Add(oneFontFamily.Name)
Next
End Sub
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: