Returns the height of a text string as it would be printed in the current font of a Form, PictureBox, or Printer. Doesn't support named arguments.
Syntax
object.TextHeight(string)
The TextHeight method syntax has these parts:
Part | Description |
object | Optional. An object expression that evaluates to an object in the Applies To list. 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.