DataGridViewCell.MeasureTextWidth Metod

Definition

Hämtar bredden i bildpunkter för den angivna texten med tanke på de angivna egenskaperna.

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

Parametrar

graphics
Graphics

Används Graphics för att återge texten.

text
String

Texten som ska mätas.

font
Font

Den Font som tillämpas på texten.

maxHeight
Int32

Textens maximala höjd.

flags
TextFormatFlags

En bitvis kombination av TextFormatFlags värden som ska tillämpas på texten.

Returer

Textens bredd, i bildpunkter.

Undantag

graphics är null.

-eller-

font är null.

maxHeight är mindre än 1.

flags är inte en giltig bitvis kombination av TextFormatFlags värden.

Gäller för

Se även