DataGridViewCell.MeasureTextWidth Método

Definição

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

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

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.

maxHeight
Int32

A altura máxima do texto.

flags
TextFormatFlags

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

Retornos

Int32

A largura, em pixels, do texto.

Exceções

graphics é null.

- ou - font é null.

maxHeight é menor que 1.

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

Aplica-se a

Confira também