このフォントの行間を返します。
オーバーロードの一覧
フォントの行間 (ピクセル単位) を返します。行間とは、2 つの連続するテキスト行のベース ライン間の垂直距離です。したがって、行間には、文字自体の高さ以外に、行と行の間の空白も含まれます。
[Visual Basic] Overloads Public Function GetHeight() As Single
[JScript] public function GetHeight() : float;
フォントの行間を、指定した Graphics オブジェクトの現在の単位で返します。行間とは、2 つの連続するテキスト行のベース ライン間の垂直距離です。したがって、行間には、文字自体の高さ以外に、行と行の間の空白も含まれます。
[Visual Basic] Overloads Public Function GetHeight(Graphics) As Single
垂直方向の指定の解像度でデバイスに描画した場合の、この Font オブジェクトの高さ (ピクセル単位) を返します。
[Visual Basic] Overloads Public Function GetHeight(Single) As Single
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。
[Visual Basic, C#] メモ ここでは、GetHeight のオーバーロード形式のうちの 1 つだけについて、使用例を示します。その他の例については、各オーバーロード形式のトピックを参照してください。
Public Sub GetHeight_Example(e As PaintEventArgs)
' Create a Font object.
Dim myFont As New Font("Arial", 16)
'Draw text to the screen with myFont.
e.Graphics.DrawString("This is the first line", myFont, _
Brushes.Black, New PointF(0, 0))
'Get the height of myFont.
Dim height As Single = myFont.GetHeight(e.Graphics)
'Draw text immediately below the first line of text.
e.Graphics.DrawString("This is the second line", myFont, _
Brushes.Black, New PointF(0, height))
End Sub
[C#]
public void GetHeight_Example(PaintEventArgs e)
{
// Create a Font object.
Font myFont = new Font("Arial", 16);
//Draw text to the screen with myFont.
e.Graphics.DrawString(
"This is the first line",
myFont,
Brushes.Black,
new PointF(0, 0));
//Get the height of myFont.
float height = myFont.GetHeight(e.Graphics);
//Draw text immediately below the first line of text.
e.Graphics.DrawString(
"This is the second line",
myFont,
Brushes.Black,
new PointF(0, height));
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。