DataGridViewCell.MeasureTextHeight Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the height, in pixels, of the specified text.
Overloads
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean) |
Gets the height, in pixels, of the specified text, given the specified characteristics. Also indicates whether the required width is greater than the specified maximum width. |
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags) |
Gets the height, in pixels, of the specified text, given the specified characteristics. |
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)
Gets the height, in pixels, of the specified text, given the specified characteristics. Also indicates whether the required width is greater than the specified maximum width.
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
Parameters
- text
- String
The text to measure.
- maxWidth
- Int32
The maximum width of the text.
- flags
- TextFormatFlags
A bitwise combination of TextFormatFlags values to apply to the text.
- widthTruncated
- Boolean
Set to true
if the required width of the text is greater than maxWidth
.
Returns
The height, in pixels, of the text.
Exceptions
maxWidth
is less than 1.
flags
is not a valid bitwise combination of TextFormatFlags values.
Remarks
If multiple lines are required and the specified formatting allows it, the height returned is the combined height of all lines.
See also
Applies to
MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)
Gets the height, in pixels, of the specified text, given the specified characteristics.
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
Parameters
- text
- String
The text to measure.
- maxWidth
- Int32
The maximum width of the text.
- flags
- TextFormatFlags
A bitwise combination of TextFormatFlags values to apply to the text.
Returns
The height, in pixels, of the text.
Exceptions
maxWidth
is less than 1.
flags
is not a valid bitwise combination of TextFormatFlags values.
Remarks
If multiple lines are required and the specified formatting allows it, the height returned is the combined height of all lines.
See also
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기