FontFamily.ToString Methode

Definition

Konvertiert diese FontFamily in eine lesbare Zeichenfolgendarstellung.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

Gibt zurück

Die Zeichenfolge, die diese FontFamily darstellt.

Beispiele

Das folgende Codebeispiel ist für die Verwendung mit Windows Forms konzipiert und erfordert PaintEventArgse, was ein Parameter des Paint Ereignishandlers ist. Der Code erstellt eine FontFamily und zeichnet eine Zeichenfolgendarstellung der Schriftfamilie auf den Bildschirm.

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.Graphics.DrawString(
        myFontFamily.ToString(),
        new Font(myFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}
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

Gilt für: