次の方法で共有


WFONT( ) Function

Returns the name, size, or style of the current font for a window in Visual FoxPro for Windows.

WFONT(nFontAttribute [, WindowName])

Return Value

Character and Numeric

Parameters

  • nFontAttribute
    Specifies the font attribute you want to return.

    If nFontAttribute is 1, WFONT( ) returns the name of the current font for the active or specified window.

    If nFontAttribute is 2, WFONT( ) returns the font size.

    If nFontAttribute is 3, WFONT( ) returns a code that identifies the font style.

    The font style code is a character or set of characters that correspond to the current font style. For example, the current font style is Bold Italic if WFONT(3) returns BI.

    The following table lists the codes for each font style:

    Character

    Font Style

    B

    Bold

    I

    Italic

    N

    Normal

    O

    Outline

    Q

    Opaque

    S

    Shadow

    StrikeThru

    T

    Transparent

    U

    Underline

  • WindowName
    Specifies the name of the window for which you want to determine the current font, font size, or font style. In Visual FoxPro, you can also include the name of a toolbar. Include the empty string to return the current font, font size, or font style for the main Visual FoxPro window.

    WindowName can be the name of a user-defined window created with DEFINE WINDOW or a text- or memo-editing window.

    You can also include the name of a system window (View, Trace, Debug, and so on). WFONT( ) can return font attributes only for a system window that has been opened and is currently visible or hidden. If the system window you specify is closed, Visual FoxPro generates an error message.

    WFONT( ) returns the current font, font size or font style for the active output window if you omit WindowName.

Example

The following example creates a user-defined window called wFontChar. The window is activated and its font characteristics are displayed in the window. The font characteristics are then displayed for the main Visual FoxPro window.

CLEAR
DEFINE WINDOW wFontChar ;
   FROM 1,1 TO 3,35 ;
   FONT 'MS SANS SERIF',8 ;
   STYLE 'BI'  && Define window with font and style
ACTIVATE WINDOW wFontChar 
? WFONT(1), WFONT(2), WFONT(3)  && wFontChar window
ACTIVATE SCREEN
?
?
?
? 'Font characteristics for the window wFontChar'
?
?
? WFONT(1,''), WFONT(2,''), WFONT(3,'')  && Main Visual FoxPro window
? 
? 'Font characteristics for the main Visual FoxPro window'
WAIT WINDOW
RELEASE WINDOW wFontChar
CLEAR

See Also

Reference

FONTMETRIC( ) Function

GETFONT( ) Function

SYSMETRIC( ) Function

TXTWIDTH( ) Function

Other Resources

Functions

Language Reference (Visual FoxPro)