FontFamily.GetEmHeight(FontStyle) Método

Definición

Obtiene el alto, en unidades de diseño de fuente, del cuadrado Em del estilo especificado.

public:
 int GetEmHeight(System::Drawing::FontStyle style);
public int GetEmHeight (System.Drawing.FontStyle style);
member this.GetEmHeight : System.Drawing.FontStyle -> int
Public Function GetEmHeight (style As FontStyle) As Integer

Parámetros

style
FontStyle

Enumeración FontStyle para la que se va a obtener el alto de Em.

Devoluciones

Alto del cuadrado Em.

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 alto de em square para esa familia de fuentes.

  • Dibuja el valor del alto em en la pantalla como texto.

public:
   void GetEmHeight_Example( PaintEventArgs^ e )
   {
      // Create a FontFamily object.
      FontFamily^ emFontFamily = gcnew FontFamily( "arial" );

      // Get the em height of the font family in design units.
      int emHeight = emFontFamily->GetEmHeight( FontStyle::Regular );

      // Draw the result as a string to the screen.
      e->Graphics->DrawString( String::Format( "emFontFamily.GetEmHeight() returns {0}.", emHeight ),
            gcnew System::Drawing::Font( emFontFamily,16 ), Brushes::Black, PointF(0,0) );
   }
public void GetEmHeight_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily emFontFamily = new FontFamily("arial");
             
    // Get the em height of the font family in design units.
    int emHeight = emFontFamily.GetEmHeight(FontStyle.Regular);
             
    // Draw the result as a string to the screen.
    e.Graphics.DrawString(
        "emFontFamily.GetEmHeight() returns " + emHeight.ToString() + ".",
        new Font(emFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}
Public Sub GetEmHeight_Example(ByVal e As PaintEventArgs)

    ' Create a FontFamily object.
    Dim emFontFamily As New FontFamily("arial")

    ' Get the em height of the font family in design units.
    Dim emHeight As Integer = _
    emFontFamily.GetEmHeight(FontStyle.Regular)

    ' Draw the result as a string to the screen.
    e.Graphics.DrawString("emFontFamily.GetEmHeight() returns " & _
    emHeight.ToString() + ".", New Font(emFontFamily, 16), _
    Brushes.Black, New PointF(0, 0))
End Sub

Comentarios

Em square es un término tipográfico que hace referencia al rectángulo ocupado por la letra más ancha de la fuente, tradicionalmente la letra M.

Se aplica a

Consulte también