Teilen über


FontFamily.GetName(Int32) Methode

Definition

Gibt den Namen in der angegebenen Sprache dieses FontFamilyzurü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, der den Namen in der angegebenen Sprache dieses FontFamilydarstellt.

Beispiele

Das folgende Codebeispiel wurde für die Verwendung mit Windows Forms entwickelt und erfordert PaintEventArgse, bei dem es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:

  • Erstellt eine FontFamily.

  • Ruft den Namen der Schriftartfamilie 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 die Sprache neutral 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, kann diese Headerdatei in der Regel relativ zum Visual Studio-Installationsverzeichnis unter \\VC\PlatformSDK\Include gefunden werden.

Gilt für: