FontFamily.GetEmHeight-Methode
Ruft die Höhe des Gevierts für den angegebenen Schriftschnitt in Schriftentwurfseinheiten ab.
Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)
Syntax
'Declaration
Public Function GetEmHeight ( _
style As FontStyle _
) As Integer
'Usage
Dim instance As FontFamily
Dim style As FontStyle
Dim returnValue As Integer
returnValue = instance.GetEmHeight(style)
public int GetEmHeight (
FontStyle style
)
public:
int GetEmHeight (
FontStyle style
)
public int GetEmHeight (
FontStyle style
)
public function GetEmHeight (
style : FontStyle
) : int
Parameter
- style
Der FontStyle, für den die Gevierthöhe abgerufen werden soll.
Rückgabewert
Die Höhe des Gevierts.
Hinweise
Geviert ist ein Begriff aus der Typografie, der sich auf das Rechteck bezieht, das vom breitesten Buchstaben der Schriftart ausgefüllt wird, normalerweise vom Buchstaben M.
Beispiel
Das folgende Codebeispiel ist für die Verwendung mit Windows Forms vorgesehen und erfordert PaintEventArgse, wobei es sich um einen Parameter des Paint-Ereignishandlers handelt. Der Code führt die folgenden Aktionen aus:
Erstellt eine FontFamily.
Ruft die Gevierthöhe für die Schriftartfamilie ab.
Zeichnet den Wert der Gevierthöhe als Text auf dem Bildschirm.
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
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:
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.get_Graphics().DrawString("emFontFamily.GetEmHeight() returns "
+ System.Convert.ToString(emHeight) + ".",
new Font(emFontFamily, 16), Brushes.get_Black(), new PointF(0, 0));
} //GetEmHeight_Example
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
FontFamily-Klasse
FontFamily-Member
System.Drawing-Namespace