DataGridViewCell.MeasureTextWidth Metoda

Definicja

Pobiera szerokość określonego tekstu w pikselach, biorąc pod uwagę określone cechy.

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);
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

Parametry

graphics
Graphics

Element Graphics używany do renderowania tekstu.

text
String

Tekst do zmierzenia.

font
Font

Zastosowane Font do tekstu.

maxHeight
Int32

Maksymalna wysokość tekstu.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości do zastosowania do tekstu.

Zwraca

Szerokość tekstu w pikselach.

Wyjątki

graphics to null.

-lub-

font to null.

maxHeight wartość jest mniejsza niż 1.

flags nie jest prawidłową kombinacją bitów TextFormatFlags wartości.

Dotyczy

Zobacz też