How to Use TXTWIDTH() Function in FoxPro for Windows

ID: Q94812

The information in this article applies to:

SUMMARY

The TXTWIDTH() function determines the width of a character expression in the font selected for the active output window. The calculation returns the width in pixels.

MORE INFORMATION

The syntax of the TXTWIDTH() function is as follows

   TXTWIDTH(<expC1>[,<expC2>,<expN1>[,<expC3>]])

where: The following examples demonstrate the usage of the TXTWIDTH() function.

This example directs output to the main FoxPro window and determines the width of the string "HELLO" in the current output font:

   ACTIVATE SCREEN
   ? TXTWIDTH("HELLO")

This example directs output to the main FoxPro window and determines the width of the string "HELLO" in 14-point Roman font:

   ACTIVATE SCREEN
   ? TXTWIDTH("HELLO","Roman",14)

This example directs output to the main FoxPro window and determines the width of the string "HELLO" in 14-point bold italic Roman font:

   ACTIVATE SCREEN
   ? TXTWIDTH("HELLO","Roman",14,"BI")

Additional reference words: FoxWin 2.50 2.50a KBCategory: kbprg KBSubcategory: FxprgGeneral

Last Reviewed: June 27, 1995