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 フォームで使用するように設計されており、イベント ハンドラーの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) によって占有される四角形を指す文字体裁用語です。

適用対象

こちらもご覧ください