DataGridViewCell.MeasureTextHeight Método

Definición

Obtiene el alto, en píxeles, del texto especificado.

Sobrecargas

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

Obtiene el alto, en píxeles, del texto especificado en función de las características que se indiquen. También indica si el ancho necesario es mayor que el ancho máximo especificado.

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

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

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

Obtiene el alto, en píxeles, del texto especificado en función de las características que se indiquen. También indica si el ancho necesario es mayor que el ancho máximo especificado.

public:
 static int MeasureTextHeight(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, int maxWidth, System::Windows::Forms::TextFormatFlags flags, [Runtime::InteropServices::Out] bool % widthTruncated);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags, out bool widthTruncated);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string? text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags, out bool widthTruncated);
static member MeasureTextHeight : System.Drawing.Graphics * string * System.Drawing.Font * int * System.Windows.Forms.TextFormatFlags * bool -> int
Public Shared Function MeasureTextHeight (graphics As Graphics, text As String, font As Font, maxWidth As Integer, flags As TextFormatFlags, ByRef widthTruncated As Boolean) 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.

maxWidth
Int32

Ancho máximo del texto.

flags
TextFormatFlags

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

widthTruncated
Boolean

Establezca el parámetro en true si el ancho necesario del texto es mayor que maxWidth.

Devoluciones

Alto del texto, expresado en píxeles.

Excepciones

graphics es null.

o bien

font es null.

maxWidth es menor que 1.

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 alto devuelto es el alto combinado de todas las líneas.

Consulte también

Se aplica a

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

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

public:
 static int MeasureTextHeight(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, int maxWidth, System::Windows::Forms::TextFormatFlags flags);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string? text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags);
static member MeasureTextHeight : System.Drawing.Graphics * string * System.Drawing.Font * int * System.Windows.Forms.TextFormatFlags -> int
Public Shared Function MeasureTextHeight (graphics As Graphics, text As String, font As Font, maxWidth 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.

maxWidth
Int32

Ancho máximo del texto.

flags
TextFormatFlags

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

Devoluciones

Alto del texto, expresado en píxeles.

Excepciones

graphics es null.

O bien

font es null.

maxWidth es menor que 1.

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 alto devuelto es el alto combinado de todas las líneas.

Consulte también

Se aplica a