TextWidth Method (AForm)

Returns the width of a text string as it would be printed in the current font.

Syntax

[ fWidth = ] Object.TextWidth ( sText )

The TextWidth 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 width is determined.

fWidth

Float

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

Comments

The width is expressed in terms of the ScaleMode property setting or Scale method coordinate system in effect for object. Use TextWidth to determine the amount of horizontal space required to display the text. If string contains embedded carriage returns, TextWidth returns the width of the longest line.

Example

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

lfrm1TextWidth = frm1.TextWidth("20")

Applies to

AForm

See Also

Scale, ScaleMode, ScaleWidth, TextHeight