CMFCToolBarFontComboBox Class
A toolbar button that contains a combo box control that enables the user to select a font from a list of system fonts.
class CMFCToolBarFontComboBox : public CMFCToolBarComboBoxButton
Members
Protected Constructors
Name |
Description |
---|---|
Constructs a CMFCToolBarFontComboBox object. |
Public Methods
Name |
Description |
---|---|
Returns a pointer to the CMFCFontInfo object for a specified index in the combo box. |
|
Selects a font in the font combo box according to either the name of the font, or the prefix and character set of the font. |
Data Members
- CMFCToolBarFontComboBox::m_nFontHeight
The height of the characters in the font combo box.
Remarks
To add a font combo box button to a toolbar, follow these steps:
Reserve a dummy resource ID for the button in the parent toolbar resource.
Construct a CMFCToolBarFontComboBox object.
In the message handler that processes the AFX_WM_RESETTOOLBAR message, replace the original button with the new combo box button by using CMFCToolBar::ReplaceButton.
Synchronize the font that is selected in the combo box with the font in the document by using the CMFCToolBarFontComboBox::SetFont method.
To synchronize the document's font with the font selected in the combo box, use the CMFCToolBarFontComboBox::GetFontDesc method to retrieve the attributes of the selected font, and use those attributes to create a CFont Class object.
The font combo box button calls the Win32 function EnumFontFamiliesEx to determine the screen and printer fonts available to the system.
Inheritance Hierarchy
Requirements
Header: afxtoolbarfontcombobox.h
See Also
Concepts
How to: Put Controls On Toolbars
Reference
CMFCToolBarComboBoxButton Class