DataGridViewCell.MeasureTextSize Método

Definición

Obtiene el alto y ancho del texto especificado en función de las características que se indiquen.

public:
 static System::Drawing::Size MeasureTextSize(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags);
public static System.Drawing.Size MeasureTextSize (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags);
static member MeasureTextSize : System.Drawing.Graphics * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags -> System.Drawing.Size
Public Shared Function MeasureTextSize (graphics As Graphics, text As String, font As Font, flags As TextFormatFlags) As Size

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.

flags
TextFormatFlags

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

Devoluciones

Size

Size que representa el alto y ancho del texto.

Excepciones

graphics es null.

O bien font es null.

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

Comentarios

Si se requieren varias líneas y el formato especificado lo permite, el tamaño devuelto incluye el alto combinado de todas las líneas.

Se aplica a

Consulte también