Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

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

Declaration

public static float GetMaximumFontSize(
    this Graphics graphics,
    FontFamily fontFamily,
    string text,
    FontStyle style = Regular,
    bool allowWordWrapping = false,
    float? maxWidth = null,
    float? maxHeight = null
)

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.
FontFamilyfontFamily The font to measure.
stringtext The text whose size mustn't exceed maxWidth and maxHeight.
FontStylestyle Font style to apply.
boolallowWordWrapping True if the text is allowed to word-wrap within the specified bounds.
float?maxWidth Maximum width the text may have, or null if only the maximum height should apply. If allowWordWrapping is true, this cannot be null.
float?maxHeight Maximum width the text may have, or null if only the maximum width should apply. If maxWidth is null, this cannot be null.