DataGridViewCell.MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) DataGridViewCell.MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) DataGridViewCell.MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) Method

Definición

Obtiene el ancho, en píxeles, del texto especificado en función de las características que se indiquen.Gets the width, in pixels, of the specified text given the specified characteristics.

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

Parámetros

graphics
Graphics Graphics Graphics

Graphics que se utiliza para representar el texto.The Graphics used to render the text.

text
String String String

Texto que se va a medir.The text to measure.

font
Font Font Font

Font que se aplica al texto.The Font applied to the text.

maxHeight
Int32 Int32 Int32

Alto máximo del texto.The maximum height of the text.

flags
TextFormatFlags TextFormatFlags TextFormatFlags

Combinación bit a bit de valores de TextFormatFlags que se va a aplicar al texto.A bitwise combination of TextFormatFlags values to apply to the text.

Devoluciones

Ancho del texto, expresado en píxeles.The width, in pixels, of the text.

Excepciones

graphics es null.graphics is null.

O bien-or- font es null.font is null.

maxHeight es menor que 1.maxHeight is less than 1.

flags no es una combinación bit a bit válida de valores TextFormatFlags.flags is not a valid bitwise combination of TextFormatFlags values.

Se aplica a

Consulte también: