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.

C#
public static int MeasureTextWidth (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxHeight, System.Windows.Forms.TextFormatFlags flags);

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

Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
Windows Desktop 3.0, 3.1, 5, 6, 7

Consulte también