DataGridViewCell.MeasureTextPreferredSize Método

Definição

Obtém a altura e a largura ideal do texto especificado, dadas as características indicadas.

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

O Graphics usado para renderizar o texto.

text
String

O texto a ser medido.

font
Font

O Font aplicado ao texto.

maxRatio
Single

A proporção máxima de largura para altura do bloco de texto.

flags
TextFormatFlags

Uma combinação bit a bit de TextFormatFlags valores a serem aplicados ao texto.

Retornos

Size

Um Size que representa a altura e a largura preferencial do texto.

Exceções

graphics é null.

- ou - font é null.

maxRatio é menor ou igual a 0.

flags não é uma combinação bit a bit válida de valores de TextFormatFlags.

Comentários

Se várias linhas forem necessárias e a formatação especificada permitir, o tamanho retornado incluirá a altura combinada de todas as linhas.

Aplica-se a

Confira também