CCommonDialog及其子类

CCommonDialog及其子类

首先,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.

Construction

CFontDialog

Constructs a CFontDialog object.

Operations

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_PRINTERFONTCF_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;

 

 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值