Export (0) Print
Expand All

CFontDialog Class

Allows you to incorporate a font-selection dialog box into your application.

class CFontDialog : public CCommonDialog

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.

Header: afxdlgs.h

This class is not supported in Smart Device projects.

Community Additions

ADD
Show:
© 2014 Microsoft