FontFamily.GetLineSpacing(FontStyle) メソッド

定義

指定したスタイルの FontFamily の行間をデザイン単位で返します。 行間とは、2 つの連続するテキスト行のベース ライン間の垂直距離です。

public:
 int GetLineSpacing(System::Drawing::FontStyle style);
public int GetLineSpacing (System.Drawing.FontStyle style);
member this.GetLineSpacing : System.Drawing.FontStyle -> int
Public Function GetLineSpacing (style As FontStyle) As Integer

パラメーター

style
FontStyle

適用する FontStyle

戻り値

連続する 2 つのテキスト行の間隔。

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

  • FontFamily を作成します。

  • フォント ファミリの行間を取得します。

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

public:
   void GetLineSpacing_Example( PaintEventArgs^ e )
   {
      // Create a FontFamily object.
      FontFamily^ myFontFamily = gcnew FontFamily( "Arial" );

      // Get the line spacing for myFontFamily.
      int lineSpacing = myFontFamily->GetLineSpacing( FontStyle::Regular );

      // Draw the value of lineSpacing to the screen as a string.
      e->Graphics->DrawString( String::Format( "lineSpacing = {0}", lineSpacing ),
            gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) );
   }
public void GetLineSpacing_Example(PaintEventArgs e)
{
    // Create a FontFamily object.
    FontFamily myFontFamily = new FontFamily("Arial");
             
    // Get the line spacing for myFontFamily.
    int lineSpacing = myFontFamily.GetLineSpacing(FontStyle.Regular);
             
    // Draw the value of lineSpacing to the screen as a string.
    e.Graphics.DrawString(
        "lineSpacing = " + lineSpacing.ToString(),
        new Font(myFontFamily, 16),
        Brushes.Black,
        new PointF(0, 0));
}
Public Sub GetLineSpacing_Example(ByVal e As PaintEventArgs)

    ' Create a FontFamily object.
    Dim myFontFamily As New FontFamily("Arial")

    ' Get the line spacing for myFontFamily.
    Dim lineSpacing As Integer = _
    myFontFamily.GetLineSpacing(FontStyle.Regular)

    ' Draw the value of lineSpacing to the screen as a string.
    e.Graphics.DrawString("lineSpacing = " & lineSpacing.ToString(), _
    New Font(myFontFamily, 16), Brushes.Black, New PointF(0, 0))
End Sub

適用対象

こちらもご覧ください