Condividi tramite


DataGridViewCell.MeasureTextPreferredSize Metodo

Definizione

Ottiene l'altezza e la larghezza ideali del testo specificato considerando le caratteristiche specificate.

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

Parametri

graphics
Graphics

Classe Graphics utilizzata per il rendering del testo.

text
String

Testo da misurare.

font
Font

Classe Font applicata al testo.

maxRatio
Single

Rapporto massimo tra larghezza e altezza del blocco di testo.

flags
TextFormatFlags

Combinazione bit per bit dei valori TextFormatFlags da applicare al testo.

Restituisce

Size

Struttura Size che rappresenta la larghezza e l'altezza preferite del testo.

Eccezioni

graphics è null.

-oppure- font è null.

maxRatio è minore o uguale a 0.

flags non è una combinazione bit per bit valida di valori di TextFormatFlags.

Commenti

Se sono necessarie più righe e la formattazione specificata lo consente, le dimensioni restituite includono l'altezza combinata di tutte le righe.

Si applica a

Vedi anche