DataGridViewCell.MeasureTextWidth Metoda

Definice

Získá šířku zadaného textu v pixelech vzhledem k zadaným charakteristikám.

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

Slouží Graphics k vykreslení textu.

text
String

Text, který chcete měřit.

font
Font

Použité Font u textu.

maxHeight
Int32

Maximální výška textu.

flags
TextFormatFlags

Bitové kombinace TextFormatFlags hodnot, které se mají použít u textu.

Návraty

Šířka textu v pixelech.

Výjimky

graphics je null.

nebo

font je null.

maxHeight je menší než 1.

flags není platná bitové kombinace TextFormatFlags hodnot.

Platí pro

Viz také