CMFCToolBarFontSizeComboBox Class
A toolbar button that contains a combo box control that enables the user to select a font size.
class CMFCToolBarFontSizeComboBox : public CMFCToolBarComboBoxButton
Members
Protected Constructors
Name |
Description |
---|---|
Constructs a CMFCToolBarFontSizeComboBox object. |
Public Methods
Name |
Description |
---|---|
Returns the selected font size in twips. |
|
Fills the combo box list with all supported font sizes for a specified font. |
|
Sets the font size in twips. |
Remarks
You can use a CMFCToolBarFontSizeComboBox object together with a CMFCToolBarFontComboBox Class object to enable a user to select a font and font size.
You can add a font size combo box button to a toolbar just as you add a font combo box button. For more information, see CMFCToolBarFontComboBox Class.
When the user selects a new font in a CMFCToolBarFontComboBox object, you can fill the font size combo box with the supported sizes for that font by using the CMFCToolBarFontSizeComboBox::RebuildFontSizes method.
Example
The following example demonstrates how to use various methods in the CMFCToolBarFontSizeComboBox class to configure a CMFCToolBarFontSizeComboBox object. The example illustrates how to retrieve the font size, in twips, from the text box, fill the font size combo box with all valid sizes of the given font, and specify the font size in twips. This code snippet is part of the Word Pad sample.
CMFCToolBarFontSizeComboBox* pSizeCombo =
DYNAMIC_DOWNCAST (CMFCToolBarFontSizeComboBox, CMFCToolBarFontSizeComboBox::GetByCmd (IDC_FONTSIZE));
if (pSizeCombo != NULL)
{
int nSize = pSizeCombo->GetTwipSize();
// CMFCFontInfo* pDesc
pSizeCombo->RebuildFontSizes (pDesc->m_strName);
pSizeCombo->SetTwipSize (nSize);
}
Inheritance Hierarchy
Requirements
Header: afxtoolbarfontcombobox.h
See Also
Tasks
Walkthrough: Putting Controls On Toolbars
Reference
CMFCToolBarComboBoxButton Class