FontFamily::GetEmHeight Method (FontStyle)
.NET Framework (current version)
Gets the height, in font design units, of the em square for the specified style.
Assembly: System.Drawing (in System.Drawing.dll)
Parameters
- style
-
Type:
System.Drawing::FontStyle
The FontStyle for which to get the em height.
Em square is a typography term that refers to the rectangle occupied by the font's widest letter, traditionally the letter M.
The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:
Creates a FontFamily.
Gets the em square height for that font family.
Draws the value of the em height to the screen as text.
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) ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: