MeasureText Method
MeasureText(String, Font)
Measures the specified string when drawn with the specified Font.
Declaration
public Size MeasureText(string text, Font font)
Parameters
Type | Name | Description |
---|---|---|
String | text | String to measure. |
Font | font | Font that defines the text format of the string. |
Returns
Type | Description |
---|---|
Size | This method returns a Size structure that represents the size,
in device-independent units (1/96th inch per unit), of the
string specified by the |
MeasureText(String, Font, Double)
Measures the specified string when drawn with the specified Font and maximum width.
Declaration
public Size MeasureText(string text, Font font, double maximumWidth)
Parameters
Type | Name | Description |
---|---|---|
String | text | String to measure. |
Font | font | Font that defines the text format of the string. |
System.Double | maximumWidth | Maximum width of the string in device-independent units (1/96th inch per unit). |
Returns
Type | Description |
---|---|
Size | This method returns a Size structure that represents the size,
in device-independent units (1/96th inch per unit), of the
string specified by the |
MeasureText(String, Font, Double, TextFormat)
Measures the specified string when drawn with the specified Font, maximum width and TextFormat.
Declaration
public Size MeasureText(string text, Font font, double maximumWidth, TextFormat format)
Parameters
Type | Name | Description |
---|---|---|
String | text | String to measure. |
Font | font | Font that defines the text format of the string. |
System.Double | maximumWidth | Maximum width of the string in device-independent units (1/96th inch per unit). |
TextFormat | format | TextFormat that specifies formatting attributes, such as alignment and trimming, that are applied to the drawn text. |
Returns
Type | Description |
---|---|
Size | This method returns a Size structure that represents the size,
in device-independent units (1/96th inch per unit), of the
string specified by the |