TextHeight Method (AForm)

Returns the height of a text string as it would be drawn in the current font.

Syntax

[ fHeight = ] Object.TextHeight ( sText )

The TextHeight property syntax has the following parts:

 

Name

Type

Description

Object

AForm

AForm object

sText

Val BString

A string expression that evaluates to a string for which the text height is determined.

fHeight

Float

An integer specifying the number of units for the vertical measurement of the interior of an object when using graphics methods or when positioning controls.

Comments

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.

Example

The following statement changes the AForm's TextHeight to 12 of the units specified by the ScaleMode property:

lfrm1TextHeight = frm1.TextHeight("12")

Applies to

AForm

See Also

Scale, ScaleHeight, ScaleMode, TextWidth