Method

Graphics.StringHeight


Warning

This item was deprecated in version 2019r2. Please use Graphics.TextHeight as a replacement.

Description

Returns as a Double the height of the text based on the current font and font size and the passed wrapWidth (in display points).

Notes

The wrapWidth parameter specifies the width (in pixels) at which text should wrap.

StringHeight is calculated as the maximum height for the font itself and not the actual height of the text. For example, with "a" vs. "A", both return the same StringHeight even though "A" has a greater height than "a".

Sample code

g.TextFont = "Helvetica"
g.TextUnit = FontUnits.Pixel
g.TextSize = 32

Dim i As Double
i = g.StringHeight("Hello world", 150)

Compatibility

All project types on all supported operating systems.