英語で読む

次の方法で共有


FontFamily.GetCellAscent(FontStyle) メソッド

定義

指定したスタイルの FontFamily のセルのアセントをデザイン単位で返します。

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

パラメーター

style
FontStyle

フォントのスタイル情報を含む FontStyle

戻り値

指定した FontStyleを使用するこの FontFamily のセルの上昇。

次のコード例は Windows フォームで使用できるように設計されており、Paint イベント ハンドラーのパラメーターである PaintEventArgseが必要です。 このコードは、次のアクションを実行します。

  • FontFamilyを作成します。

  • そのフォント ファミリのセルのアセントを取得します。

  • セルの値をテキストとして画面に描画します。

C#
public void GetCellAscent_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily ascentFontFamily = new FontFamily("arial");
             
    // Get the cell ascent of the font family in design units.
    int cellAscent = ascentFontFamily.GetCellAscent(FontStyle.Regular);
             
    // Draw the result as a string to the screen.
    e.Graphics.DrawString(
        "ascentFontFamily.GetCellAscent() returns " + cellAscent.ToString() + ".",
        new Font(ascentFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}

適用対象

製品 バージョン
.NET 6, 7, 8, 9
.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
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

こちらもご覧ください