📄 configdlg.cpp
字号:
// ConfigDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ProcessEnum.h"
#include "ConfigDlg.h"
#include ".\configdlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern CSkinMagic m_skindlg;
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg dialog
CConfigDlg::CConfigDlg(CWnd* pParent /*=NULL*/,int lockhz,BOOL autoresearch,int waittime,int times)
: CDialog(CConfigDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConfigDlg)
m_eLockHz = lockhz;
m_eTimes = times;
m_eWaitTime = waittime;
m_bIsAuto = autoresearch;
//}}AFX_DATA_INIT
}
void CConfigDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConfigDlg)
DDX_Control(pDX, IDC_SLIDER_WAITTIME, m_sWaitTime);
DDX_Control(pDX, IDC_SLIDER_TIMES, m_sTimes);
DDX_Control(pDX, IDC_SLIDER_LOCKHZ, m_sLockHz);
DDX_Text(pDX, IDC_EDIT_LOCKHZ, m_eLockHz);
DDX_Text(pDX, IDC_EDITTIMES, m_eTimes);
DDX_Text(pDX, IDC_EDITWAITTIME, m_eWaitTime);
DDX_Check(pDX, IDC_CHECK_AUTO, m_bIsAuto);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConfigDlg, CDialog)
//{{AFX_MSG_MAP(CConfigDlg)
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_LOCKHZ, OnCustomdrawSliderLockhz)
ON_EN_CHANGE(IDC_EDIT_LOCKHZ, OnChangeEditLockhz)
ON_EN_CHANGE(IDC_EDITTIMES, OnChangeEdittimes)
ON_EN_CHANGE(IDC_EDITWAITTIME, OnChangeEditwaittime)
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_TIMES, OnCustomdrawSliderTimes)
ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER_WAITTIME, OnCustomdrawSliderWaittime)
ON_BN_CLICKED(IDC_BUTTON_DEF, OnButtonDef)
ON_BN_CLICKED(IDC_BUTTON_CHANGE, OnButtonChange)
ON_BN_CLICKED(IDC_CHECK_AUTO, OnCheckAuto)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_STATIC_AUTO, OnBnClickedStaticAuto)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConfigDlg message handlers
void CConfigDlg::OnCustomdrawSliderLockhz(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
UpdateData();
m_eLockHz=m_sLockHz.GetPos();
UpdateData(false);
}
void CConfigDlg::OnChangeEditLockhz()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
m_sLockHz.SetPos(m_eLockHz);
UpdateData(false);
}
BOOL CConfigDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_sLockHz.SetRangeMax(2000,false);
m_sLockHz.SetPos(m_eLockHz);
m_sWaitTime.SetRangeMax(2000,false);
m_sWaitTime.SetPos(m_eWaitTime);
m_sTimes.SetRangeMax(10,false);
m_sTimes.SetPos(m_eTimes);
UpdateData(false);
if(!m_bIsAuto)
{
GetDlgItem(IDC_SLIDER_WAITTIME)->EnableWindow(false);
GetDlgItem(IDC_SLIDER_TIMES)->EnableWindow(false);
GetDlgItem(IDC_EDITWAITTIME)->EnableWindow(false);
GetDlgItem(IDC_EDITTIMES)->EnableWindow(false);
}
else
{
GetDlgItem(IDC_SLIDER_WAITTIME)->EnableWindow(true);
GetDlgItem(IDC_SLIDER_TIMES)->EnableWindow(true);
GetDlgItem(IDC_EDITWAITTIME)->EnableWindow(true);
GetDlgItem(IDC_EDITTIMES)->EnableWindow(true);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CConfigDlg::OnChangeEdittimes()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
m_sTimes.SetPos(m_eTimes);
UpdateData(false);
}
void CConfigDlg::OnChangeEditwaittime()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
UpdateData();
m_sWaitTime.SetPos(m_eWaitTime);
UpdateData(false);
}
void CConfigDlg::OnCustomdrawSliderTimes(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
UpdateData();
m_eTimes=m_sTimes.GetPos();
UpdateData(false);
}
void CConfigDlg::OnCustomdrawSliderWaittime(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
UpdateData();
m_eWaitTime=m_sWaitTime.GetPos();
UpdateData(false);
}
void CConfigDlg::OnButtonDef()
{
// TODO: Add your control notification handler code here
m_sLockHz.SetRangeMax(2000,false);
m_sLockHz.SetPos(100);
m_eLockHz=100;
m_sWaitTime.SetRangeMax(2000,false);
m_sWaitTime.SetPos(100);
m_eWaitTime=100;
m_sTimes.SetRangeMax(10,false);
m_sTimes.SetPos(3);
m_eTimes=3;
m_bIsAuto=0;
UpdateData(false);
GetDlgItem(IDC_SLIDER_WAITTIME)->EnableWindow(false);
GetDlgItem(IDC_SLIDER_TIMES)->EnableWindow(false);
GetDlgItem(IDC_EDITWAITTIME)->EnableWindow(false);
GetDlgItem(IDC_EDITTIMES)->EnableWindow(false);
}
void CConfigDlg::OnCheckAuto()
{
// TODO: Add your control notification handler code here
UpdateData();
if(m_bIsAuto)
{
GetDlgItem(IDC_SLIDER_WAITTIME)->EnableWindow(true);
GetDlgItem(IDC_SLIDER_TIMES)->EnableWindow(true);
GetDlgItem(IDC_EDITWAITTIME)->EnableWindow(true);
GetDlgItem(IDC_EDITTIMES)->EnableWindow(true);
}
else
{
GetDlgItem(IDC_SLIDER_WAITTIME)->EnableWindow(false);
GetDlgItem(IDC_SLIDER_TIMES)->EnableWindow(false);
GetDlgItem(IDC_EDITWAITTIME)->EnableWindow(false);
GetDlgItem(IDC_EDITTIMES)->EnableWindow(false);
}
}
void CConfigDlg::OnBnClickedStaticAuto()
{
// TODO: 在此添加控件通知处理程序代码
}
void CConfigDlg::OnButtonChange()
{
CString m_strSkinfile;
CFileDialog dlg(
TRUE,
"*.smf", "*.smf" ,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT ,
"SkinMagic Files(*.smf)|*.smf||" ,
this
);
if( dlg.DoModal() == IDOK )
{
m_strSkinfile = dlg.GetPathName();
m_skindlg.LoadSkinFile(dlg.GetPathName());
}
m_skindlg.SetDialogSkin("Dialog");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -