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)
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
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)
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
- Source:
- DataGridViewCell.cs
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.