Method MeasureText
MeasureText(string, Font, double)
Measures the specified string when drawn with the specified Font and maximum width.
SizeD MeasureText(string text, Font font, double maximumWidth)
Parameters
textstringString to measure.
fontFontFont that defines the text format of the string.
maximumWidthdoubleMaximum width of the string in device-independent units.
Returns
- SizeD
This method returns a SizeD structure that represents the size, in device-independent units, of the string specified by the
textparameter as drawn with thefontparameter.
MeasureText(string, Font, double, TextFormat)
Measures the specified string when drawn with the specified Font, maximum width and TextFormat.
SizeD MeasureText(string text, Font font, double maximumWidth, TextFormat format)
Parameters
textstringString to measure.
fontFontFont that defines the text format of the string.
maximumWidthdoubleMaximum width of the string in device-independent units.
formatTextFormatTextFormat that specifies formatting attributes, such as alignment and trimming, that are applied to the drawn text.