FontFamily.GetName(Int32) Método

Definición

Devuelve el nombre, en el lenguaje especificado, de este objeto 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

Lenguaje en que se devuelve el nombre.

Devoluciones

Objeto String que representa el nombre de este objeto FontFamily, en el lenguaje especificado.

Ejemplos

El ejemplo de código siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del Paint controlador de eventos. El código realiza las siguientes acciones:

  • Crea una interfaz FontFamily.

  • Obtiene el nombre de la familia de fuentes.

  • Dibuja el nombre de la familia de fuentes en la pantalla 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

Comentarios

Para indicar el idioma neutro, debe especificar 0 para el language parámetro . Para obtener una lista de los idiomas y sublanguages disponibles, consulta el archivo de encabezado Winnt.h. Si tiene Instalado Visual Studio, este archivo de encabezado normalmente se puede encontrar en relación con el directorio de instalación de Visual Studio en \\VC\PlatformSDK\Include.

Se aplica a