CFontDialog Class
Allows you to incorporate a font-selection dialog box into your application.
class CFontDialog : public CCommonDialog
Members
Public Constructors
Name |
Description |
---|---|
Constructs a CFontDialog object. |
Public Methods
Name |
Description |
---|---|
Displays the dialog and allows the user to make a selection. |
|
Retrieves the character formatting of the selected font. |
|
Returns the color of the selected font. |
|
Assigns the characteristics of the currently selected font to a LOGFONT structure. |
|
Returns the face name of the selected font. |
|
Returns the point size of the selected font. |
|
Returns the style name of the selected font. |
|
Returns the weight of the selected font. |
|
Determines whether the font is bold. |
|
Determines whether the font is italic. |
|
Determines whether the font is displayed with strikeout. |
|
Determines whether the font is underlined. |
Public Data Members
Name |
Description |
---|---|
A structure used to customize a CFontDialog object. |
Remarks
A CFontDialog object is a dialog box with a list of fonts that are currently installed in the system. The user can select a particular font from the list, and this selection is then reported back to the application.
To construct a CFontDialog object, use the provided constructor or derive a new subclass and use your own custom constructor.
Once a CFontDialog object has been constructed, you can use the m_cf structure to initialize the values or states of controls in the dialog box. The m_cf structure is of type CHOOSEFONT. For more information on this structure, see the Windows SDK.
After initializing the dialog object's controls, call the DoModal member function to display the dialog box and allow the user to select a font. DoModal returns whether the user selected the OK (IDOK) or Cancel (IDCANCEL) button.
If DoModal returns IDOK, you can use one of CFontDialog's member functions to retrieve the information input by the user.
You can use the Windows CommDlgExtendedError function to determine whether an error occurred during initialization of the dialog box and to learn more about the error. For more information on this function, see the Windows SDK.
CFontDialog relies on the COMMDLG.DLL file that ships with Windows versions 3.1 and later.
To customize the dialog box, derive a class from CFontDialog, provide a custom dialog template, and add a message-map to process the notification messages from the extended controls. Any unprocessed messages should be passed to the base class.
Customizing the hook function is not required.
For more information on using CFontDialog, see Common Dialog Classes.
Inheritance Hierarchy
CFontDialog
Requirements
Header: afxdlgs.h