TextHeight

Returns the height of a text string as it would be printed in the current font of a Form, PictureBox, or Printer. Named arguments are not supported.

Syntax

object.TextHeight (string)

The parts of the TextHeight method syntax are described in the following table.

Part Description
object Optional. An object expression that evaluates to an object. If object is omitted, the Form object with the focus is assumed to be object.
string Required. A string expression that evaluates to a string for which the text height is determined. Parentheses must enclose the string expression.

Remarks

The height is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextHeight to determine the amount of vertical space required to display the text. The height returned includes the normal leading space above and below the text, so you can use the height to calculate and position multiple lines of text within object.

If string contains embedded carriage returns, TextHeight returns the cumulative height of the lines, including the leading space above and below each line.