DataGridViewCell.MeasureTextHeight メソッド

定義

指定したテキストの高さをピクセル単位で取得します。

オーバーロード

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

特性を指定して、指定したテキストの高さをピクセル単位で取得します。 また、必要な幅が、指定された最大幅より大きいかどうかも示します。

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

特性を指定して、指定したテキストの高さをピクセル単位で取得します。

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

特性を指定して、指定したテキストの高さをピクセル単位で取得します。 また、必要な幅が、指定された最大幅より大きいかどうかも示します。

public:
 static int MeasureTextHeight(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, int maxWidth, System::Windows::Forms::TextFormatFlags flags, [Runtime::InteropServices::Out] bool % widthTruncated);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags, out bool widthTruncated);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string? text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags, out bool widthTruncated);
static member MeasureTextHeight : System.Drawing.Graphics * string * System.Drawing.Font * int * System.Windows.Forms.TextFormatFlags * bool -> int
Public Shared Function MeasureTextHeight (graphics As Graphics, text As String, font As Font, maxWidth As Integer, flags As TextFormatFlags, ByRef widthTruncated As Boolean) As Integer

パラメーター

graphics
Graphics

テキストを表示するために使用する Graphics

text
String

計測対象のテキスト。

font
Font

テキストに適用される Font

maxWidth
Int32

テキストの最大幅。

flags
TextFormatFlags

テキストに適用される TextFormatFlags 値のビットごとの組み合わせ。

widthTruncated
Boolean

テキストの必要な幅が maxWidth より大きい場合、true に設定します。

戻り値

テキストの高さ (ピクセル単位)。

例外

graphicsnullです。

または

fontnullです。

maxWidth が 1 未満です。

flags は、TextFormatFlags 値のビットごとの正しい組み合わせではありません。

注釈

複数の行が必要で、指定した書式設定で許可されている場合、返される高さはすべての行の合計高さになります。

こちらもご覧ください

適用対象

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

特性を指定して、指定したテキストの高さをピクセル単位で取得します。

public:
 static int MeasureTextHeight(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, int maxWidth, System::Windows::Forms::TextFormatFlags flags);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string? text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags);
static member MeasureTextHeight : System.Drawing.Graphics * string * System.Drawing.Font * int * System.Windows.Forms.TextFormatFlags -> int
Public Shared Function MeasureTextHeight (graphics As Graphics, text As String, font As Font, maxWidth As Integer, flags As TextFormatFlags) As Integer

パラメーター

graphics
Graphics

テキストを表示するために使用する Graphics

text
String

計測対象のテキスト。

font
Font

テキストに適用される Font

maxWidth
Int32

テキストの最大幅。

flags
TextFormatFlags

テキストに適用される TextFormatFlags 値のビットごとの組み合わせ。

戻り値

テキストの高さ (ピクセル単位)。

例外

graphicsnullです。

または

fontnullです。

maxWidth が 1 未満です。

flags は、TextFormatFlags 値のビットごとの正しい組み合わせではありません。

注釈

複数の行が必要で、指定した書式設定で許可されている場合、返される高さはすべての行の合計高さになります。

こちらもご覧ください

適用対象