FontFamily.GetName(Int32) Metoda

Definice

Vrátí v zadaném jazyce název tohoto FontFamilyjazyka .

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

Parametry

language
Int32

Jazyk, ve kterém je název vrácen.

Návraty

A String , který představuje název v zadaném jazyce tohoto FontFamilyobjektu .

Příklady

Následující příklad kódu je určen pro použití s model Windows Forms a vyžaduje PaintEventArgse, což je parametr obslužné rutiny Paint události. Kód provede následující akce:

  • Vytvoří .FontFamily

  • Získá název rodiny písem.

  • Nakreslí název rodiny písem na obrazovku jako text.

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

Poznámky

Chcete-li označit jazykově neutrální, měli byste jako language parametr zadat hodnotu 0. Seznam dostupných jazyků a dílčích jazyků najdete v souboru hlaviček Winnt.h. Pokud máte nainstalovanou sadu Visual Studio, lze tento soubor hlaviček obvykle najít vzhledem k instalačnímu adresáři sady Visual Studio na adrese \\VC\PlatformSDK\Include.

Platí pro