FontFamily.GetEmHeight(FontStyle) Metodo

Definizione

Ottiene l'altezza, in unità di progettazione del carattere, del quadrato em per lo stile specificato.

C#
public int GetEmHeight(System.Drawing.FontStyle style);

Parametri

style
FontStyle

Il FontStyle per cui ottenere l'altezza em.

Restituisce

Altezza del quadrato em.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Form e richiede PaintEventArgse, che è un parametro del gestore eventi Paint. Il codice esegue le azioni seguenti:

  • Crea un FontFamily.

  • Ottiene l'altezza quadrata em per la famiglia di caratteri.

  • Disegna il valore dell'altezza em sullo schermo come testo.

C#
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));
}

Commenti

quadratico Em è un termine tipografico che fa riferimento al rettangolo occupato dalla lettera più larga del carattere, tradizionalmente la lettera M.

Si applica a

Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

Vedi anche