📄 brushcolordlg.cpp
字号:
// BrushColorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Ch11Demo2.h"
#include "BrushColorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define WM_SET_COLOR WM_USER+100//自定义消息
/////////////////////////////////////////////////////////////////////////////
// CBrushColorDlg dialog
CBrushColorDlg::CBrushColorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CBrushColorDlg::IDD, pParent)
{
ASSERT(pParent);//窗口对象有效
m_pParent=pParent;//获取窗口对象
//{{AFX_DATA_INIT(CBrushColorDlg)
m_red = 0;
m_green = 0;
m_blue = 0;
//}}AFX_DATA_INIT
}
void CBrushColorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBrushColorDlg)
DDX_Text(pDX, IDC_EDIT1, m_red);
DDV_MinMaxInt(pDX, m_red, 0, 255);
DDX_Text(pDX, IDC_EDIT2, m_green);
DDV_MinMaxInt(pDX, m_green, 0, 255);
DDX_Text(pDX, IDC_EDIT3, m_blue);
DDV_MinMaxInt(pDX, m_blue, 0, 255);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CBrushColorDlg, CDialog)
//{{AFX_MSG_MAP(CBrushColorDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBrushColorDlg message handlers
void CBrushColorDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();//获取编辑框数据
m_pParent->SendMessage(WM_SET_COLOR,(WPARAM)this);//发送自定义消息
//CDialog::OnOK();
}
void CBrushColorDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -