📄 modaldlg.cpp
字号:
// ModalDlg.cpp : implementation file
//
#include "stdafx.h"
#include "chapter08.h"
#include "ModalDlg.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CModalDlg dialog
CModalDlg::CModalDlg(CWnd* pParent /*=NULL*/)
: CDialog(CModalDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CModalDlg)
m_strTittle = _T("");
m_ulong = 0;
m_ushort = 0;
m_uthick = 0;
//}}AFX_DATA_INIT
}
void CModalDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CModalDlg)
DDX_Text(pDX, IDC_TITTLE, m_strTittle);
DDV_MaxChars(pDX, m_strTittle, 15);
DDX_Text(pDX, IDC_LONG, m_ulong);
DDX_Text(pDX, IDC_SHORT, m_ushort);
DDX_Text(pDX, IDC_THICK, m_uthick);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CModalDlg, CDialog)
//{{AFX_MSG_MAP(CModalDlg)
ON_BN_CLICKED(IDC_BUTTON_COLOR, OnButtonColor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CModalDlg message handlers
BOOL CModalDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_strTittle = _T("新的主框架标题");
m_ulong = 20;
m_ushort = 20;
m_uthick = 2;
UpdateData(FALSE);
////////////////////////////
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CModalDlg::OnButtonColor()
{
// TODO: Add your control notification handler code here
CColorDialog color;
if(color.DoModal()==IDOK)
{
CMainFrame* pMainFrm=(CMainFrame*)AfxGetMainWnd();
//获取选定线条的颜色
pMainFrm->m_color=color.GetColor();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -