Skip to main content

BrickGraphics.MeasureString(String, Font, Int32, StringFormat, GraphicsUnit) Method

Measures the height and width of the specified text string.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v24.2.Core.dll

NuGet Package: DevExpress.Printing.Core

#Declaration

public static SizeF MeasureString(
    string text,
    Font font,
    int width,
    StringFormat stringFormat,
    GraphicsUnit pageUnit
)

#Parameters

Name Type Description
text String

String to measure.

font Font

A Font object that defines the text format of the string.

width Int32

An integer value specifying the maximum width of the measured string.

stringFormat StringFormat

A StringFormat object that represents the string’s formatting.

pageUnit GraphicsUnit

A GraphicsUnit enumeration value that specifies the unit of measurement for the return value.

#Returns

Type Description
SizeF

This method returns a SizeF structure that represents the size, measured in pixels.

#Remarks

This method is similar to the standard MeasureString method, and is used for more precise calculations.

This method overload uses GDI/GDI+ rendering and works only on Windows OS. The PlatformNotSupportedException is thrown on other operating systems. Use the BrickGraphics.MeasureString(String, DXFont, Int32, DXStringFormat, DXGraphicsUnit) overload in non-Windows environments.

See Also