Skip to main content

GraphicsCache.CalcTextSize(String, Font, StringFormat, Int32) Method

Calculates the size of the specified string when it is drawn with the specified font and formatting.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v23.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

Declaration

public SizeF CalcTextSize(
    string text,
    Font font,
    StringFormat strFormat,
    int maxWidth
)

Parameters

Name Type Description
text String

A String value that specifies the string to measure.

font Font

A Font object that specifies the font settings (face, size, style) used to draw the text.

strFormat StringFormat

A StringFormat object that specifies the text format, such as the line spacing and alignment.

maxWidth Int32

An integer value that specifies the maximum width, in pixels, of the text.

Returns

Type Description
SizeF

A SizeF structure that specifies the text size in pixels.

See Also