FontFamily.GetEmHeight(FontStyle) 메서드

정의

지정된 스타일의 em 정사각형의 높이를 글꼴 디자인 단위로 가져옵니다.

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

매개 변수

style
FontStyle

em 높이를 가져올 FontStyle입니다.

반환

em 사각형의 높이를 반환합니다.

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • FontFamily을 만듭니다.

  • 해당 글꼴 패밀리의 정사각형 높이를 가져옵니다.

  • em 높이의 값을 텍스트로 화면에 그립니다.

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

설명

Em square 는 글꼴의 가장 넓은 문자인 일반적으로 문자 M이 차지하는 사각형을 참조하는 입력 체계 용어입니다.

적용 대상

추가 정보