DataGridViewCell.MeasureTextWidth メソッド

定義

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

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

パラメーター

graphics
Graphics

テキストのレンダリングに使用する Graphics

text
String

測定するテキスト。

font
Font

テキストに適用 Font

maxHeight
Int32

テキストの最大高さ。

flags
TextFormatFlags

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

返品

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

例外

graphicsnullです。

-または-

fontnullです。

maxHeight が 1 未満です。

flags は、 TextFormatFlags 値の有効なビットごとの組み合わせではありません。

適用対象

こちらもご覧ください