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.
- dc
- The device context in which to measure the text.
- text
- The text to measure.
- font
- The System.Drawing.Font to apply to the measured text.
- proposedSize
- The System.Drawing.Size of the initial bounding rectangle.
The System.Drawing.Size, in pixels, of text drawn with the specified font.
The TextRenderer.MeasureText(System.Drawing.IDeviceContext, string, System.Drawing.Font, System.Drawing.Size) method uses the proposedSize parameter to indicate the relationship of height to width when determining the text size. When measuring text on a single line, if the proposedSize parameter represents a System.Drawing.Size with a height dimension greater than int.MaxValue, the returned System.Drawing.Size will be adjusted to reflect the actual height of the text.