Dlg之DoModal

  下面是摘自MSDN中的一段.万变不离其宗

CColorDialog

基类:CObject

 

The CColorDialog class allows you to incorporate a color-selection dialog box into your application. A CColorDialog object is a dialog box with a list of colors that are defined for the display system. The user can select or create a particular color from the list, which is then reported back to the application when the dialog box exits.

To construct a CColorDialog object, use the provided constructor or derive a new class and use your own custom constructor.

Once the dialog box has been constructed, you can set or modify any values in the m_cc structure to initialize the values of the dialog box’s controls. The m_cc structure is of type CHOOSECOLOR.

After initializing the dialog box’s controls, call the DoModal member function to display the dialog box and allow the user to select a color. DoModal returns the user’s selection of either the dialog box’s OK (IDOK) or Cancel (IDCANCEL) button.

If DoModal returns IDOK, you can use one of CColorDialog’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.

CColorDialog relies on the COMMDLG.DLL file that ships with Windows versions 3.1 and later.

To customize the dialog box, derive a class from CColorDialog, 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.

Note   On some installations the CColorDialog object will not display with a gray background if you have used the framework to make other CDialog objects gray.

For more information on using CColorDialog, see Common Dialog Classes in Visual C++ Programmer's Guide.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值