Partager via


CMFCToolBarFontComboBox::CMFCToolBarFontComboBox

Constructs a CMFCToolBarFontComboBox Class object.

public:
CMFCToolBarFontComboBox(
   UINT uiID,
   int iImage,
   int nFontType = DEVICE_FONTTYPE | RASTER_FONTTYPE | TRUETYPE_FONTTYPE,
   BYTE nCharSet = DEFAULT_CHARSET,
   DWORD dwStyle = CBS_DROPDOWN,
   int iWidth = 0,
   BYTE nPitchAndFamily = DEFAULT_PITCH
); 
protected:
CMFCToolBarFontComboBox(
   CObList* pLstFontsExternal,
   int nFontType,
   BYTE nCharSet,
   BYTE nPitchAndFamily 
);
CMFCToolBarFontComboBox();

Parameters

  • [in] uiID
    The command ID of the combo box.

  • [in] iImage
    The zero-based index of a toolbar image. The image is located in the CMFCToolBarImages Class object that CMFCToolBar Class class maintains.

  • [in] nFontType
    The types of fonts that the combo box contains. This parameter can be a combination (boolean OR) of the following values:

    DEVICE_FONTTYPE

    RASTER_FONTTYPE

    TRUETYPE_FONTTYPE

  • [in] nCharSet
    If set to DEFAULT_CHARSET, the combo box contains all uniquely-named fonts in all character sets. (If there are two fonts with the same name, the combo box contains one of them.) If set to a valid character set value, the combo box contains only fonts in the specified character set. See LOGFONT for a listing of possible character sets.

  • [in] dwStyle
    The style of the combo box. (see Combo-Box Styles)

  • [in] iWidth
    The width in pixels of the edit control.

  • [in] nPitchAndFamily
    If set to DEFAULT_PITCH, the combo box contains fonts regardless of pitch. If set to FIXED_PITCH or VARIABLE_PITCH, the combo box contains only fonts with that pitch type. Filtering based on font family is not currently supported.

  • [out] pLstFontsExternal
    Pointer to a CObList Class object that stores the available fonts.

Remarks

Usually, CMFCToolBarFontComboBox objects store the list of available fonts in a single shared CObList object. If you use the second overload of the constructor and provide a valid pointer to pLstFontsExternal, that CMFCToolBarFontComboBox object will instead fill the CObList that pLstFontsExternal points to with available fonts.

Example

The following example demonstrates how to construct a CMFCToolBarFontComboBox object. This code snippet is part of the Word Pad sample.

CMFCToolBarFontComboBox* CFormatBar::CreateFontComboButton ()
{
    // CSize m_szBaseUnits 
    return new CMFCToolBarFontComboBox (IDC_FONTNAME, 
        GetCmdMgr ()->GetCmdImage  (IDC_FONTNAME, FALSE),
        TRUETYPE_FONTTYPE | DEVICE_FONTTYPE,
        DEFAULT_CHARSET,
        WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN |
        CBS_AUTOHSCROLL | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED,
        (3*LF_FACESIZE*m_szBaseUnits.cx)/2);
}

Requirements

Header: afxtoolbarfontcombobox.h

See Also

Reference

CMFCToolBarFontComboBox Class

Hierarchy Chart