Freigeben über


FontFamily.ToString-Methode

Konvertiert diese FontFamily in eine lesbare Zeichenfolgendarstellung.

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

Syntax

'Declaration
Public Overrides Function ToString As String
'Usage
Dim instance As FontFamily
Dim returnValue As String

returnValue = instance.ToString
public override string ToString ()
public:
virtual String^ ToString () override
public String ToString ()
public override function ToString () : String

Rückgabewert

Die Zeichenfolge, die diese FontFamily darstellt.

Beispiel

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code erstellt ein FontFamily-Objekt und zeichnet eine Zeichenfolgendarstellung der Schriftartfamilie auf dem Bildschirm.

Public Sub ToString_Example(ByVal e As PaintEventArgs)

    ' Create a FontFamily object.
    Dim myFontFamily As New FontFamily("Arial")

    ' Draw a string representation of myFontFamily to the screen.
    e.Graphics.DrawString(myFontFamily.ToString(), _
    New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub
public void ToString_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily myFontFamily = new FontFamily("Arial");
             
    // Draw a string representation of myFontFamily to the screen.
    e.Graphics.DrawString(
        myFontFamily.ToString(),
        new Font(myFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}
public:
   void ToString_Example( PaintEventArgs^ e )
   {
      // Create a FontFamily object.
      FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );

      // Draw a string representation of myFontFamily to the screen.
      e->Graphics->DrawString( myFontFamily->ToString(), gcnew System::Drawing::Font( myFontFamily,16 ),
            Brushes::Black, PointF(0,0) );
   }
public void ToString_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily myFontFamily = new FontFamily("Arial");

    // Draw a string representation of myFontFamily to the screen.
    e.get_Graphics().DrawString(myFontFamily.ToString(), 
        new Font(myFontFamily, 16), Brushes.get_Black(), 
        new PointF(0, 0));
} //ToString_Example

Plattformen

Windows 98, Windows 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

.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-Klasse
FontFamily-Member
System.Drawing-Namespace