DataGridViewCell.MeasureTextHeight Metoda

Definicja

Pobiera wysokość w pikselach określonego tekstu.

Przeciążenia

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

Pobiera wysokość w pikselach określonego tekstu, biorąc pod uwagę określone cechy. Wskazuje również, czy wymagana szerokość jest większa niż określona maksymalna szerokość.

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

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

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

Pobiera wysokość w pikselach określonego tekstu, biorąc pod uwagę określone cechy. Wskazuje również, czy wymagana szerokość jest większa niż określona maksymalna szerokość.

public:
 static int MeasureTextHeight(System::Drawing::Graphics ^ graphics, System::String ^ text, System::Drawing::Font ^ font, int maxWidth, System::Windows::Forms::TextFormatFlags flags, [Runtime::InteropServices::Out] bool % widthTruncated);
public static int MeasureTextHeight (System.Drawing.Graphics graphics, string text, System.Drawing.Font font, int maxWidth, System.Windows.Forms.TextFormatFlags flags, out bool widthTruncated);
static member MeasureTextHeight : System.Drawing.Graphics * string * System.Drawing.Font * int * System.Windows.Forms.TextFormatFlags * bool -> int
Public Shared Function MeasureTextHeight (graphics As Graphics, text As String, font As Font, maxWidth As Integer, flags As TextFormatFlags, ByRef widthTruncated As Boolean) As Integer

Parametry

graphics
Graphics

Element Graphics używany do renderowania tekstu.

text
String

Tekst do zmierzenia.

font
Font

Element Font zastosowany do tekstu.

maxWidth
Int32

Maksymalna szerokość tekstu.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości do zastosowania do tekstu.

widthTruncated
Boolean

Ustaw wartość na true , jeśli wymagana szerokość tekstu jest większa niż maxWidth.

Zwraca

Int32

Wysokość tekstu w pikselach.

Wyjątki

graphics to null.

-lub- font to null.

maxWidth wartość jest mniejsza niż 1.

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, zwracana wysokość jest łączną wysokością wszystkich wierszy.

Zobacz też

Dotyczy

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

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

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

Parametry

graphics
Graphics

Element Graphics używany do renderowania tekstu.

text
String

Tekst do zmierzenia.

font
Font

Element Font zastosowany do tekstu.

maxWidth
Int32

Maksymalna szerokość tekstu.

flags
TextFormatFlags

Bitowa kombinacja TextFormatFlags wartości do zastosowania do tekstu.

Zwraca

Int32

Wysokość tekstu w pikselach.

Wyjątki

graphics to null.

-lub- font to null.

maxWidth wartość jest mniejsza niż 1.

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, zwracana wysokość jest łączną wysokością wszystkich wierszy.

Zobacz też

Dotyczy