DataGridViewCell.MeasureTextSize メソッド

定義

特性を指定して、指定したテキストの高さと幅を取得します。

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

パラメーター

graphics
Graphics

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

text
String

計測対象のテキスト。

font
Font

テキストに適用される Font

flags
TextFormatFlags

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

戻り値

テキストの高さと幅を表す Size

例外

graphicsnullです。

または

fontnullです。

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

注釈

複数の行が必要で、指定した書式設定で許可されている場合、返されるサイズにはすべての行の高さが組み合わされます。

適用対象

こちらもご覧ください