Skip to main content
A newer version of this page is available. .

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

Calculates the size of the specified string when it’s drawn with the specified font and using the specified formatting.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v18.2.dll

Declaration

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

Parameters

Name Type Description
text String

A String value which represents a string to measure.

font Font

A Font object which defines the font and the associated settings of the text.

strFormat StringFormat

A StringFormat object which represents formatting information, such as the line spacing and alignment of the string.

maxWidth Int32

An integer value specifying the maximum width of the string (in pixels).

Returns

Type Description
SizeF

A SizeF structure which represents the size (in pixels) of the string.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CalcTextSize(String, Font, StringFormat, Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also