Microsoft KB Archive/94812

{| = How to Use TXTWIDTH Function in FoxPro for Windows =
 * width="100%"|

ID: Q94812

The information in this article applies to:


 * Microsoft FoxPro for Windows, versions 2.5 and 2.5a

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([,,[,]]) where:
 *  specifies the string to use in the calculation.
 *  specifies the font to use in the calculation.
 *  specifies the font size to use in the calculation.
 *  specifies the font style to use in the calculation.

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 &quot;HELLO&quot; in the current output font:

ACTIVATE SCREEN ? TXTWIDTH(&quot;HELLO&quot;) This example directs output to the main FoxPro window and determines the width of the string &quot;HELLO&quot; in 14-point Roman font: ACTIVATE SCREEN ? TXTWIDTH(&quot;HELLO&quot;,&quot;Roman&quot;,14) This example directs output to the main FoxPro window and determines the width of the string &quot;HELLO&quot; in 14-point bold italic Roman font: ACTIVATE SCREEN ? TXTWIDTH(&quot;HELLO&quot;,&quot;Roman&quot;,14,&quot;BI&quot;) Additional reference words: FoxWin 2.50 2.50a KBCategory: kbprg KBSubcategory: FxprgGeneral
 * }