DataGridViewCell.MeasureTextPreferredSize Metoda

Definicja

Pobiera idealną wysokość i szerokość określonego tekstu, biorąc pod uwagę określone cechy.

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

Parametry

graphics
Graphics

Element Graphics używany do renderowania tekstu.

text
String

Tekst do zmierzenia.

font
Font

Element Font zastosowany do tekstu.

maxRatio
Single

Maksymalny współczynnik szerokości do wysokości bloku tekstu.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości do zastosowania do tekstu.

Zwraca

Size

Reprezentująca Size preferowaną wysokość i szerokość tekstu.

Wyjątki

graphics to null.

-lub- font to null.

maxRatio wartość jest mniejsza lub równa 0.

flags nie jest prawidłową kombinacją bitów TextFormatFlags wartości.

Uwagi

Jeśli wymagane jest wiele wierszy i umożliwia to określone formatowanie, zwracany rozmiar obejmuje łączną wysokość wszystkich wierszy.

Dotyczy

Zobacz też