Bagikan melalui


FontFamily.ToString Metode

Definisi

Mengonversi FontFamily ini menjadi representasi string yang dapat dibaca manusia.

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

Mengembalikan

String yang mewakili FontFamilyini .

Contoh

Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse, yang merupakan parameter penanganan aktivitas Paint. Kode membuat FontFamily dan menggambar representasi string dari keluarga font ke layar.

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

Berlaku untuk