DataGridViewCell.MeasureTextSize Método

Definição

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

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);
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

O Graphics usado para renderizar o texto.

text
String

O texto a ser medido.

font
Font

O Font aplicado ao texto.

flags
TextFormatFlags

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

Retornos

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

Exceções

graphics é null.

- ou -

font é null.

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