DataGridViewCell.MeasureTextHeight 方法

定义

获取指定文本的高度(以像素为单位)。

重载

名称 说明
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

获取指定文本的高度(以像素为单位),给定指定的特征。 还指示所需的宽度是否大于指定的最大宽度。

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

获取指定文本的高度(以像素为单位),给定指定的特征。

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

Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs

获取指定文本的高度(以像素为单位),给定指定的特征。 还指示所需的宽度是否大于指定的最大宽度。

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

参数

graphics
Graphics

Graphics用于呈现文本。

text
String

要度量的文本。

font
Font

Font应用于文本。

maxWidth
Int32

文本的最大宽度。

flags
TextFormatFlags

要应用于文本的值的 TextFormatFlags 按位组合。

widthTruncated
Boolean

如果文本的所需宽度大于,则设置为 < /gt;。

返回

文本的高度(以像素为单位)。

例外

graphicsnull

-或-

fontnull

maxWidth 小于 1。

flags 不是值的有效按位组合 TextFormatFlags

注解

如果需要多行并且指定的格式允许它,则返回的高度是所有行的组合高度。

另请参阅

适用于

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

Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs
Source:
DataGridViewCell.cs

获取指定文本的高度(以像素为单位),给定指定的特征。

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

参数

graphics
Graphics

Graphics用于呈现文本。

text
String

要度量的文本。

font
Font

Font应用于文本。

maxWidth
Int32

文本的最大宽度。

flags
TextFormatFlags

要应用于文本的值的 TextFormatFlags 按位组合。

返回

文本的高度(以像素为单位)。

例外

graphicsnull

-或-

fontnull

maxWidth 小于 1。

flags 不是值的有效按位组合 TextFormatFlags

注解

如果需要多行并且指定的格式允许它,则返回的高度是所有行的组合高度。

另请参阅

适用于