[]
        
(Showing Draft Content)

GrapeCity.Documents.Drawing.GcGraphics.MeasureString

MeasureString Method

MeasureString(string, TextFormat, SizeF, TextSplitOptions, out int)

Measures a string using a specified TextFormat, available layout size and TextSplitOptions. Also calculates and returns in an output parameter the number of chars that fit into the specified size.

Declaration
public SizeF MeasureString(string text, TextFormat textFormat, SizeF layoutSize, TextSplitOptions splitOptions, out int fitCharCount)
Public Function MeasureString(text As String, textFormat As TextFormat, layoutSize As SizeF, splitOptions As TextSplitOptions, ByRef fitCharCount As Integer) As SizeF
Parameters
Type Name Description
string text

The string to measure.

TextFormat textFormat

The text format to use.

SizeF layoutSize

The maximum available size for the layout.

TextSplitOptions splitOptions

The options controlling how to split the text if it does not fit into the specified size.

int fitCharCount

OUT: The number of chars that fit into the specified size.

Returns
Type Description
SizeF

The actual size needed to draw the string.

MeasureString(string, TextFormat, SizeF, out int)

Measures a string using a specified TextFormat, available layout size and default split options (see TextSplitOptions). Also calculates and returns in an output parameter the number of chars that fit into the specified size.

Declaration
public SizeF MeasureString(string text, TextFormat textFormat, SizeF layoutSize, out int fitCharCount)
Public Function MeasureString(text As String, textFormat As TextFormat, layoutSize As SizeF, ByRef fitCharCount As Integer) As SizeF
Parameters
Type Name Description
string text

The string to measure.

TextFormat textFormat

The text format to use.

SizeF layoutSize

The maximum available size for the layout.

int fitCharCount

OUT: The number of chars that fit into the specified size.

Returns
Type Description
SizeF

The actual size needed to draw the string.

MeasureString(string, Font, float, float?)

Measures a string using a specified font, font size and layout width.

Declaration
public SizeF MeasureString(string text, Font font, float fontSize, float? width = null)
Public Function MeasureString(text As String, font As Font, fontSize As Single, Optional width As Single? = Nothing) As SizeF
Parameters
Type Name Description
string text

The string to measure.

Font font

The font to use.

float fontSize

The font size to use.

float? width

The width allocated to draw the string, or null to indicate unlimited width.

Returns
Type Description
SizeF

The size needed to draw the string.

MeasureString(string, TextFormat, float?)

Measures a string using a specified TextFormat.

Declaration
public SizeF MeasureString(string text, TextFormat textFormat, float? width = null)
Public Function MeasureString(text As String, textFormat As TextFormat, Optional width As Single? = Nothing) As SizeF
Parameters
Type Name Description
string text

The string to measure.

TextFormat textFormat

The text format to use.

float? width

The width allocated to draw the string, or null to indicate unlimited width.

Returns
Type Description
SizeF

The size needed to draw the string.