FontFamily.GetName(Int32) Methode

Definition

Gibt den Namen dieses FontFamily-Objekts in der angegebenen Sprache zurück.

public:
 System::String ^ GetName(int language);
public string GetName (int language);
member this.GetName : int -> string
Public Function GetName (language As Integer) As String

Parameter

language
Int32

Die Sprache, in der der Name zurückgegeben wird.

Gibt zurück

Ein String-Objekt, das den Namen für dieses FontFamily-Objekt in der angegebenen Sprache 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 führt die folgenden Aktionen aus:

  • Erstellt eine FontFamily.

  • Ruft den Namen der Schriftfamilie ab.

  • Zeichnet den Namen der Schriftfamilie als Text auf den Bildschirm.

public:
   void GetName_Example( PaintEventArgs^ e )
   {
      // Create a FontFamily object.
      FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );

      // Get the name of myFontFamily.
      String^ familyName = myFontFamily->GetName( 0 );

      // Draw the name of the myFontFamily to the screen as a string.
      e->Graphics->DrawString( String::Format( "The family name is {0}", familyName ),
            gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
   }
public void GetName_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily myFontFamily = new FontFamily("Arial");
             
    // Get the name of myFontFamily.
    string familyName = myFontFamily.GetName(0);
             
    // Draw the name of the myFontFamily to the screen as a string.
    e.Graphics.DrawString(
        "The family name is " + familyName,
        new Font(myFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}
Public Sub GetName_Example(ByVal e As PaintEventArgs)

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

    ' Get the name of myFontFamily.
    Dim familyName As String = myFontFamily.GetName(0)

    ' Draw the name of the myFontFamily to the screen as a string.
    e.Graphics.DrawString("The family name is " & familyName, _
    New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub

Hinweise

Um sprachneutral anzugeben, sollten Sie 0 für den language Parameter angeben. Eine Liste der verfügbaren Sprachen und Untersprachen finden Sie in der Winnt.h-Headerdatei. Wenn Sie Visual Studio installiert haben, finden Sie diese Headerdatei in der Regel relativ zum Visual Studio-Installationsverzeichnis unter \\VC\PlatformSDK\Include.

Gilt für: