description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CMFCToolBarFontSizeComboBox Class |
CMFCToolBarFontSizeComboBox Class |
11/04/2016 |
|
|
72e0c44c-6a0e-4194-a71f-ab64e3afb9b5 |
A toolbar button that contains a combo box control that enables the user to select a font size.
class CMFCToolBarFontSizeComboBox : public CMFCToolBarComboBoxButton
Name | Description |
---|---|
CMFCToolBarFontSizeComboBox::CMFCToolBarFontSizeComboBox | Constructs a CMFCToolBarFontSizeComboBox object. |
Name | Description |
---|---|
CMFCToolBarFontSizeComboBox::GetTwipSize | Returns the selected font size in twips. |
CMFCToolBarFontSizeComboBox::RebuildFontSizes | Fills the combo box list with all supported font sizes for a specified font. |
CMFCToolBarFontSizeComboBox::SetTwipSize | Sets the font size in twips. |
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.
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.
[!code-cppNVC_MFC_WordPad#8]
Header: afxtoolbarfontcombobox.h
Constructs a CMFCToolBarFontSizeComboBox
object.
CMFCToolBarFontSizeComboBox();
Retrieves the font size, in twips, from the text box of a font size combo box.
int GetTwipSize() const;
If the return value is positive, it is the font size in twips. It is -1 if the text box of the combo box is empty. It is -2 if an error occurs.
Fills a font size combo box with all valid sizes of the given font.
void RebuildFontSizes(const CString& strFontName);
strFontName
[in] Specifies a font name.
Call this function when you want to synchronize between selection in a font combo box and a font size combo box, such as a CMFCToolBarFontComboBox Class.
Rounds the specified size (in twips) to the nearest size in points, and then sets the selected size in the combo box to that value.
void SetTwipSize(int nSize);
nSize
[in] Specifies the font size (in twips) to set.
You can retrieve the previous valid font size later by calling the CMFCToolBarFontSizeComboBox::GetTwipSize method.
Hierarchy Chart
Classes
CMFCToolBar Class
CMFCToolBarButton Class
CMFCToolBarComboBoxButton Class
CMFCFontInfo Class
CMFCToolBar::ReplaceButton
Walkthrough: Putting Controls On Toolbars