Share via


CMFCFontComboBox::SelectFont

Selects the font that matches the specified criteria from the font combo box.

BOOL SelectFont(
   CMFCFontInfo* pDesc 
);
BOOL SelectFont(
   LPCTSTR lpszName,
   BYTE nCharSet=DEFAULT_CHARSET 
);

Parameters

  • [in] pDesc
    Points to a font description object.

  • [in] lpszName
    Specifies a font name.

  • [in] nCharSet
    Specifies a character set. The default value is DEFAULT_CHARSET. For more information, see the lfCharSet member of the LOGFONT structure.

Return Value

TRUE if an item in the font combo box matches the specified font description object or font name and charset; otherwise, FALSE.

Remarks

Use this method to select and scroll to the item in the font combo box that corresponds to the specified font.

Example

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

 CMFCFontComboBox m_wndFont;


...


    m_wndFont.SelectFont(_T("Arial"));

Requirements

Header: afxfontcombobox.h

See Also

Reference

CMFCFontComboBox Class

Hierarchy Chart

CMFCFontInfo Class

CComboBox::SetCurSel

LOGFONT