FontFamily.GetName(Int32) Método

Definição

Retorna o nome, no idioma especificado, dessa FontFamily.

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

Parâmetros

language
Int32

O idioma em que o nome é retornado.

Retornos

Uma String que representa o nome, no idioma especificado, dessa FontFamily.

Exemplos

O exemplo de código a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do Paint manipulador de eventos. O código executa as seguintes ações:

  • Cria um FontFamily.

  • Obtém o nome da família de fontes.

  • Desenha o nome da família de fontes para a tela como texto.

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

Comentários

Para indicar a linguagem neutra, você deve especificar 0 para o language parâmetro . Para obter uma listagem dos idiomas e sublanguages disponíveis, consulte o arquivo de cabeçalho Winnt.h. Se você tiver o Visual Studio instalado, esse arquivo de cabeçalho normalmente poderá ser encontrado em relação ao diretório de instalação do Visual Studio em \\VC\PlatformSDK\Include.

Aplica-se a