TextWidth Method

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

 [nWidth =] [Form.]TextWidth(cText)

Parameters

  • nWidth
    Returns a value in pixels specifying the width of the text string.

  • cText
    Specifies the character string for which the text width is determined.

Remarks

Applies To: Form Object | _SCREEN System Variable

The TextWidth method determines the amount of horizontal space required to display cText.

If you want to get the length of a character expression with respect to the average character width for a font, use the TXTWIDTH( ) Function.

See Also

Reference

FontSize Property

ScaleMode Property

TextHeight Method

Other Resources

Methods (Visual FoxPro)