TextRenderer.MeasureText Method
.NET Framework 3.5
Measures the specified text when drawn with the specified font.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
| Name | Description | |
|---|---|---|
|
MeasureText(String, Font) | Provides the size, in pixels, of the specified text when drawn with the specified font. |
|
MeasureText(IDeviceContext, String, Font) | Provides the size, in pixels, of the specified text drawn with the specified font in the specified device context. |
|
MeasureText(String, Font, Size) | Provides the size, in pixels, of the specified text when drawn with the specified font, using the specified size to create an initial bounding rectangle. |
|
MeasureText(IDeviceContext, String, Font, Size) | Provides the size, in pixels, of the specified text when drawn with the specified font in the specified device context, using the specified size to create an initial bounding rectangle for the text. |
|
MeasureText(String, Font, Size, TextFormatFlags) | Provides the size, in pixels, of the specified text when drawn with the specified font and formatting instructions, using the specified size to create the initial bounding rectangle for the text. |
|
MeasureText(IDeviceContext, String, Font, Size, TextFormatFlags) | Provides the size, in pixels, of the specified text when drawn with the specified device context, font, and formatting instructions, using the specified size to create the initial bounding rectangle for the text. |
Incorrect size, height or width
Set the From.AutoScaleMode to Dpi, if it is set to Font, string measurements for labels and controls will not be correct. Note this does impact scaling for different screen sizes.
- 10/7/2009
- Troy Werner
- 10/7/2009
- Troy Werner