Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: float GetMaximumFontSize(this Graphics, SizeF, FontFamily, string, FontStyle, bool)

Declaration

public static float GetMaximumFontSize(
    this Graphics graphics,
    SizeF maximumSize,
    FontFamily fontFamily,
    string text,
    FontStyle style = Regular,
    bool allowWordWrapping = false
)

Summary

Determines the largest font size at which the specified text fits into the specified maximum size in the specified font.

Parameters

this Graphicsgraphics Specifies the Graphics object to use when measuring the font size.
SizeFmaximumSize Maximum size (in pixels) the text should have.
FontFamilyfontFamily The font to measure.
stringtext The text whose size mustn't exceed maximumSize.
FontStylestyle Font style to apply.
boolallowWordWrapping True if the text is allowed to word-wrap within the specified bounds.