DataGridViewCell.MeasureTextPreferredSize メソッド

定義

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

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

パラメーター

graphics
Graphics

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

text
String

計測対象のテキスト。

font
Font

テキストに適用される Font

maxRatio
Single

テキストのブロックの、最大の幅と高さの比率。

flags
TextFormatFlags

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

戻り値

Size

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

例外

graphicsnullです。

または fontnullです。

maxRatio が 0 以下です。

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

注釈

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

適用対象

こちらもご覧ください