CCommonDialog及其子类
2006-09-02 21:42
127 查看
CCommonDialog及其子类
首先,CCommonDialog派生于CDialog,它本身只有一个构造函数
CCommonDialog的子类包括:
CFileDialog,CFontDialog,CColorDialog,CPageSetupDialog,
CPrintDialog,CPrintDialogEx,
CFindReplaceDialog,COleDialog
(这里仅介绍CFontDialog,因为所有这些对话框的操作都是相似的,所以可以举一反三)
CFontDialog
直接使用:
调用CFontDialog的构造函数;
调整CHOOSEFONT结构;
调用CFontDialog::DoModal()函数;
若用户选择后点了OK按钮,则返回ID_OK,此时可以使用CFontDialog的成员函数来取得用户的输入。
成员:Data Members
Construction
Operations
其中,CHOOSEFONT结构为:
typedef struct {
DWORD lStructSize;//该结构的大小,以byte衡量
HWND hwndOwner;//父窗口
HDC hDC;//若Flags值非CF_PRINTERFONT或CF_BOTH时,该值被忽略
LPLOGFONT lpLogFont;//该值定义了字体的一系列属性,参见MSDN
INT iPointSize;//以点的1/10为单位
DWORD Flags;//参见MSDN
COLORREF rgbColors;//一个RGB颜色值
LPARAM lCustData;
LPCFHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
HINSTANCE hInstance;
LPTSTR lpszStyle;
WORD nFontType;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONT, *LPCHOOSEFONT;
首先,CCommonDialog派生于CDialog,它本身只有一个构造函数
CCommonDialog的子类包括:
CFileDialog,CFontDialog,CColorDialog,CPageSetupDialog,
CPrintDialog,CPrintDialogEx,
CFindReplaceDialog,COleDialog
(这里仅介绍CFontDialog,因为所有这些对话框的操作都是相似的,所以可以举一反三)
CFontDialog
直接使用:
调用CFontDialog的构造函数;
调整CHOOSEFONT结构;
调用CFontDialog::DoModal()函数;
若用户选择后点了OK按钮,则返回ID_OK,此时可以使用CFontDialog的成员函数来取得用户的输入。
成员:Data Members
m_cf | A structure used to customize a CFontDialog object. |
CFontDialog | Constructs a CFontDialog object. |
DoModal | Displays the dialog and allows the user to make a selection. |
GetCharFormat | Retrieves the character formatting of the selected font. |
GetColor | Returns the color of the selected font. |
GetCurrentFont | Retrieves the name of the currently selected font. |
GetFaceName | Returns the face name of the selected font. |
GetSize | Returns the point size of the selected font. |
GetStyleName | Returns the style name of the selected font. |
GetWeight | Returns the weight of the selected font. |
IsBold | Determines whether the font is bold. |
IsItalic | Determines whether the font is italic. |
IsStrikeOut | Determines whether the font is displayed with strikeout. | IsUnderline | Determines whether the font is underlined. |
其中,CHOOSEFONT结构为:
typedef struct {
DWORD lStructSize;//该结构的大小,以byte衡量
HWND hwndOwner;//父窗口
HDC hDC;//若Flags值非CF_PRINTERFONT或CF_BOTH时,该值被忽略
LPLOGFONT lpLogFont;//该值定义了字体的一系列属性,参见MSDN
INT iPointSize;//以点的1/10为单位
DWORD Flags;//参见MSDN
COLORREF rgbColors;//一个RGB颜色值
LPARAM lCustData;
LPCFHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
HINSTANCE hInstance;
LPTSTR lpszStyle;
WORD nFontType;
INT nSizeMin;
INT nSizeMax;
} CHOOSEFONT, *LPCHOOSEFONT;
相关文章推荐
- Android之对话框AlertDialog及其子类的介绍(一)
- Android之对话框AlertDialog及其子类的使用(二)
- ui.Dialog及其子类
- AdapterView及其子类之三:基于ListView及ArrayAdapter实现列表
- 17、Map接口及其常用子类(Hashtable、HashMap、WeakHashMap)
- Android的ViewAnimator及其子类ViewSwitcher-android学习之旅(三十三)
- 2014-2-12AdapterView及其子类2
- 2014-2-13AdapterView及其子类3
- 在Struts中使用 DispatchAction 及其子类
- Set及其子类
- Map及其子类
- CommonDialog Control Constants
- Android从零单排之Adapter及其子类
- Android用户界面 UI组件--TextView及其子类(二) Button,selector选择器,sharp属性
- 关于UIView及其子类重绘drawRect
- Java的 字节流 InputStream 类及其子类 FileInputStream 的使用
- Android用户界面UI组件--AdapterView及其子类(三) ExpandableListView
- Android界面编程之四 第三组UI组件:ImageView及其子类
- UI组件之TextView及其子类