DataGridViewCell.MeasureTextWidth Methode

Definition

Ruft die Breite des angegebenen Texts in Pixel mit den angegebenen Eigenschaften ab.

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

Parameter

graphics
Graphics

Die Graphics, mit der Text gerendert wird.

text
String

Der zu bemessende Text.

font
Font

Der auf den Text angewendete Font.

maxHeight
Int32

Die maximale Höhe des Texts.

flags
TextFormatFlags

Eine bitweise Kombination von TextFormatFlags-Werten, die auf den Text angewendet werden sollen.

Gibt zurück

Int32

Die Breite des Texts in Pixel.

Ausnahmen

graphics ist null.

- oder - font ist null.

maxHeight ist kleiner als 1.

flags ist keine gültige bitweise Kombination von TextFormatFlags-Werten.

Gilt für

Siehe auch