DataGridViewCell.MeasureTextHeight 方法      
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取指定文本的高度(以像素为单位)。
重载
| MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean) | 
						 根据指定的特性,获取指定文本的高度(以像素为单位)。 它还指示所需宽度是否大于指定的最大宽度。  | 
        	
| MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags) | 
						 根据指定的特性,获取指定文本的高度(以像素为单位)。  | 
        	
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)
根据指定的特性,获取指定文本的高度(以像素为单位)。 它还指示所需宽度是否大于指定的最大宽度。
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
	参数
- text
 - String
 
要测量的文本。
- maxWidth
 - Int32
 
文本的最大宽度。
- flags
 - TextFormatFlags
 
要应用于文本的 TextFormatFlags 值的按位组合。
- widthTruncated
 - Boolean
 
如果文本的所需宽度大于 maxWidth,则设置为 true。
返回
文本的高度(以像素为单位)。
例外
              maxWidth 小于 1。
              flags 不是 TextFormatFlags 值的有效按位组合。
注解
如果需要多行并且指定的格式允许,则返回的高度是所有行的组合高度。
另请参阅
适用于
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)
根据指定的特性,获取指定文本的高度(以像素为单位)。
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
	参数
- text
 - String
 
要测量的文本。
- maxWidth
 - Int32
 
文本的最大宽度。
- flags
 - TextFormatFlags
 
要应用于文本的 TextFormatFlags 值的按位组合。
返回
文本的高度(以像素为单位)。
例外
              maxWidth 小于 1。
              flags 不是 TextFormatFlags 值的有效按位组合。
注解
如果需要多行并且指定的格式允许,则返回的高度是所有行的组合高度。