DataGridViewCell.MeasureTextWidth Methode

Definitie

Hiermee haalt u de breedte in pixels van de opgegeven tekst op op basis van de opgegeven kenmerken.

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

Parameters

graphics
Graphics

De Graphics tekst die wordt gebruikt om de tekst weer te geven.

text
String

De te meten tekst.

font
Font

De Font toegepaste tekst.

maxHeight
Int32

De maximale hoogte van de tekst.

flags
TextFormatFlags

Een bitsgewijze combinatie van TextFormatFlags waarden die op de tekst moeten worden toegepast.

Retouren

De breedte, in pixels, van de tekst.

Uitzonderingen

graphics is null.

– of –

font is null.

maxHeight is kleiner dan 1.

flags is geen geldige bitsgewijze combinatie van TextFormatFlags waarden.

Van toepassing op

Zie ook