DataGridViewCell.MeasureTextPreferredSize Método

Definición

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

public:
 static System::Drawing::Size MeasureTextPreferredSize(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, float maxRatio, System::Windows::Forms::TextFormatFlags flags);
public static System.Drawing.Size MeasureTextPreferredSize (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, float maxRatio, System.Windows.Forms.TextFormatFlags flags);
static member MeasureTextPreferredSize : System.Drawing.Graphics * string * System.Drawing.Font * single * System.Windows.Forms.TextFormatFlags -> System.Drawing.Size
Public Shared Function MeasureTextPreferredSize (graphics As Graphics, text As String, font As Font, maxRatio As Single, 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.

maxRatio
Single

Máxima proporción de ancho por alto del bloque de 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 preferidos del texto.

Excepciones

graphics es null.

O bien font es null.

maxRatio es menor o igual que 0.

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