Freigeben über


FontFamily-Klasse

Definiert eine Gruppe von Schriftarten mit ähnlichem Grundformat und bestimmten Unterschieden beim Schriftschnitt. Diese Klasse kann nicht geerbt werden.

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

Syntax

'Declaration
Public NotInheritable Class FontFamily
    Inherits MarshalByRefObject
    Implements IDisposable
'Usage
Dim instance As FontFamily
public sealed class FontFamily : MarshalByRefObject, IDisposable
public ref class FontFamily sealed : public MarshalByRefObject, IDisposable
public final class FontFamily extends MarshalByRefObject implements IDisposable
public final class FontFamily extends MarshalByRefObject implements IDisposable

Beispiel

Im folgenden Codebeispiel sind alle Schriftartfamilien in der Families-Eigenschaft der FontFamily-Klasse dargestellt. Dieses Beispiel ist für die Verwendung mit einem Windows Form vorgesehen. Fügen Sie zum Ausführen dieses Beispiels einem Formular die ListBox mit dem Namen listBox1 hinzu, und rufen Sie die PopulateListBoxWithFonts-Methode im Konstruktor des Formulars auf.

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
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->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.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

Vererbungshierarchie

System.Object
   System.MarshalByRefObject
    System.Drawing.FontFamily

Threadsicherheit

Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

FontFamily-Member
System.Drawing-Namespace

Weitere Ressourcen

Verwenden von Schriftarten und Text