Condividi tramite


CMFCFontComboBox::Setup

Initializes the list of items in the font combo box.

BOOL Setup(
   int nFontType=DEVICE_FONTTYPE|RASTER_FONTTYPE|TRUETYPE_FONTTYPE,
   BYTE nCharSet=DEFAULT_CHARSET,
   BYTE nPitchAndFamily=DEFAULT_PITCH 
);

Parameters

  • [in] nFontType
    Specifies the font type. The default value is the bitwise combination (OR) of DEVICE_FONTTYPE, RASTER_FONTTYPE, and TRUETYPE_FONTTYPE.

  • [in] nCharSet
    Specifies the font character set. The default value is DEFAULT_CHARSET.

  • [in] nPitchAndFamily
    Specifies the font pitch and family. The default value is DEFAULT_PITCH.

Return Value

TRUE if the font combo box was initialized successfully; otherwise, FALSE.

Remarks

This method initializes the font combo box by enumerating the currently installed fonts that match the specified parameters and inserting those font names in the font combo box.

Example

The following example demonstrates how to use the Setup method in the CMFCFontComboBox class. This example is part of the New Controls sample.

    CMFCFontComboBox m_wndFont;


...


    // specify the font type
    // BOOL m_bTrueType: true font type
    // BOOL m_bRaster: raster font type
    // BOOL m_bDeviceFont: device font type
    int nFontType = 0;

    if (m_bTrueType)
    {
        nFontType |= TRUETYPE_FONTTYPE;
    }

    if (m_bRaster)
    {
        nFontType |= RASTER_FONTTYPE;
    }

    if (m_bDeviceFont)
    {
        nFontType |= DEVICE_FONTTYPE;
    }

    CWaitCursor wait;
    m_wndFont.Setup(nFontType);

Requirements

Header: afxfontcombobox.h

See Also

Reference

CMFCFontComboBox Class

Hierarchy Chart

LOGFONT