DataGridViewCell.MeasureTextWidth Método

Definición

Obtiene el ancho, en píxeles, del texto especificado en función de las características que se indiquen.

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

Parámetros

graphics
Graphics

Graphics que se utiliza para representar el texto.

text
String

Texto que se va a medir.

font
Font

Font que se aplica al texto.

maxHeight
Int32

Alto máximo del texto.

flags
TextFormatFlags

Combinación bit a bit de valores de TextFormatFlags que se va a aplicar al texto.

Devoluciones

Int32

Ancho del texto, expresado en píxeles.

Excepciones

graphics es null.

O bien font es null.

maxHeight es menor que 1.

flags no es una combinación bit a bit válida de valores TextFormatFlags.

Se aplica a

Consulte también