DataGridViewCell.MeasureTextSize Metoda

Definicja

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

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

Parametry

graphics
Graphics

Element Graphics używany do renderowania tekstu.

text
String

Tekst do zmierzenia.

font
Font

Element Font zastosowany do tekstu.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości do zastosowania do tekstu.

Zwraca

Size

Reprezentujący Size wysokość i szerokość tekstu.

Wyjątki

graphics to null.

-lub- font to null.

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ż