📄 setdlg.cpp
字号:
// SetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "drawsys.h"
#include "SetDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog
CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetDlg)
m_lPenColor = RGB(0,0,255);
m_iPenWidth = 1;
m_lBkColor = RGB(255,255,255);
m_lFillColor = RGB(255,0,0);
//}}AFX_DATA_INIT
m_dlsDrawLSort=DlsBresenham;
m_bitmapOk.LoadBitmap(IDB_OK);
m_bitmapCancel.LoadBitmap(IDB_CANCEL);
m_hIcon=AfxGetApp()->LoadIcon(IDI_SET);
}
void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSetDlg)
DDX_Control(pDX, IDC_COMBO_DRAWSORT, m_comboDrawLSort);
DDX_Control(pDX, IDOK, m_btnOK);
DDX_Control(pDX, IDCANCEL, m_btnCancel);
DDX_Text(pDX, IDC_EDIT_PENCOLOR, m_lPenColor);
DDX_Text(pDX, IDC_EDIT_PENWIDTH, m_iPenWidth);
DDX_Text(pDX, IDC_EDIT_BKCOLOR, m_lBkColor);
DDX_Text(pDX, IDC_EDIT_FILLCOLOR, m_lFillColor);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
//{{AFX_MSG_MAP(CSetDlg)
ON_BN_CLICKED(IDC_BTN_PENCOLOR, OnBtnPencolor)
ON_BN_CLICKED(IDC_BTN_BKCOLOR, OnBtnBkcolor)
ON_BN_CLICKED(IDC_BTN_FILLCOLOR, OnBtnFillcolor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers
BOOL CSetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetIcon(m_hIcon,1);
m_btnOK.SetBitmap(m_bitmapOk);
m_btnCancel.SetBitmap(m_bitmapCancel);
if(m_dlsDrawLSort==DlsBresenham)
m_comboDrawLSort.SetCurSel(0);
else
m_comboDrawLSort.SetCurSel(1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSetDlg::OnBtnPencolor()
{
// TODO: Add your control notification handler code here
CColorDialog ColorDialog;
if(ColorDialog.DoModal()==IDOK)
m_lPenColor=ColorDialog.GetColor();
UpdateData(0);
}
void CSetDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(1);
if(m_comboDrawLSort.GetCurSel()==0)
m_dlsDrawLSort=DlsBresenham;
else
m_dlsDrawLSort=DlsDDA;
CDialog::OnOK();
}
void CSetDlg::OnBtnBkcolor()
{
// TODO: Add your control notification handler code here
CColorDialog ColorDialog;
if(ColorDialog.DoModal()==IDOK)
m_lBkColor=ColorDialog.GetColor();
UpdateData(0);
}
void CSetDlg::OnBtnFillcolor()
{
// TODO: Add your control notification handler code here
CColorDialog ColorDialog;
if(ColorDialog.DoModal()==IDOK)
m_lFillColor=ColorDialog.GetColor();
UpdateData(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -