📄 mypropertyrset.cpp
字号:
// MyPropertyRSet.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "MyPropertyRSet.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CMyPropertyComplete, CPropertyPage)
IMPLEMENT_DYNCREATE(CMyPropertyDiscrete, CPropertyPage)
IMPLEMENT_DYNCREATE(CMyPropertyAttRedu, CPropertyPage)
IMPLEMENT_DYNCREATE(CMyPropertyValRedu, CPropertyPage)
/////////////////////////////////////////////////////////////////////////////
// CMyPropertyComplete property page
CMyPropertyComplete::CMyPropertyComplete() : CPropertyPage(CMyPropertyComplete::IDD)
{
m_bShow=true;
//{{AFX_DATA_INIT(CMyPropertyComplete)
m_bSaveFile = FALSE;
m_strPathName = _T("");
m_iAlgorithm = 0;
m_bOpenFile = TRUE;
//}}AFX_DATA_INIT
}
CMyPropertyComplete::~CMyPropertyComplete()
{
}
void CMyPropertyComplete::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPropertyComplete)
DDX_Check(pDX, IDC_SAVEFILE, m_bSaveFile);
DDX_Text(pDX, IDC_PATHNAME, m_strPathName);
DDX_CBIndex(pDX, IDC_ALGORITHM, m_iAlgorithm);
DDX_Check(pDX, IDC_OPENFILE, m_bOpenFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPropertyComplete, CPropertyPage)
//{{AFX_MSG_MAP(CMyPropertyComplete)
ON_BN_CLICKED(IDC_SAVEFILE, OnSavefile)
ON_BN_CLICKED(IDC_VIEW, OnView)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPropertyDiscrete property page
CMyPropertyDiscrete::CMyPropertyDiscrete() : CPropertyPage(CMyPropertyDiscrete::IDD)
{
m_bShow=true;
//{{AFX_DATA_INIT(CMyPropertyDiscrete)
m_iAlgorithm = 1;
m_bSaveFile = FALSE;
m_strPathName = _T("");
m_bOpenFile = TRUE;
// m_bnotdis = FALSE;
//}}AFX_DATA_INIT
}
CMyPropertyDiscrete::~CMyPropertyDiscrete()
{
}
void CMyPropertyDiscrete::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPropertyDiscrete)
DDX_CBIndex(pDX, IDC_ALGORITHM, m_iAlgorithm);
DDX_Check(pDX, IDC_SAVEFILE, m_bSaveFile);
DDX_Text(pDX, IDC_PATHNAME, m_strPathName);
DDX_Check(pDX, IDC_OPENFILE, m_bOpenFile);
// DDX_Check(pDX, IDC_NOTDISC, m_bnotdis);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPropertyDiscrete, CPropertyPage)
//{{AFX_MSG_MAP(CMyPropertyDiscrete)
ON_BN_CLICKED(IDC_VIEW, OnView)
ON_BN_CLICKED(IDC_SAVEFILE, OnSavefile)
ON_BN_CLICKED(IDC_NOTDISC, OnNotdisc)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPropertyAttRedu property page
CMyPropertyAttRedu::CMyPropertyAttRedu() : CPropertyPage(CMyPropertyAttRedu::IDD)
{
m_bShow=true;
//{{AFX_DATA_INIT(CMyPropertyAttRedu)
m_iAlgorithm = 4;
m_strPathName = _T("");
m_bSaveFile = FALSE;
m_bOpenFile = TRUE;
//}}AFX_DATA_INIT
}
CMyPropertyAttRedu::~CMyPropertyAttRedu()
{
}
void CMyPropertyAttRedu::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPropertyAttRedu)
DDX_CBIndex(pDX, IDC_ALGORITHM, m_iAlgorithm);
DDX_Text(pDX, IDC_PATHNAME, m_strPathName);
DDX_Check(pDX, IDC_SAVEFILE, m_bSaveFile);
DDX_Check(pDX, IDC_OPENFILE, m_bOpenFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPropertyAttRedu, CPropertyPage)
//{{AFX_MSG_MAP(CMyPropertyAttRedu)
ON_BN_CLICKED(IDC_VIEW, OnView)
ON_BN_CLICKED(IDC_SAVEFILE, OnSavefile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyPropertyValRedu property page
CMyPropertyValRedu::CMyPropertyValRedu() : CPropertyPage(CMyPropertyValRedu::IDD)
{
m_bShow=true;
//{{AFX_DATA_INIT(CMyPropertyValRedu)
m_iAlgorithm = 1;
m_strPathName = _T("");
m_bSaveFile = FALSE;
m_bOpenFile = TRUE;
//}}AFX_DATA_INIT
}
CMyPropertyValRedu::~CMyPropertyValRedu()
{
}
void CMyPropertyValRedu::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMyPropertyValRedu)
DDX_CBIndex(pDX, IDC_ALGORITHM, m_iAlgorithm);
DDX_Text(pDX, IDC_PATHNAME, m_strPathName);
DDX_Check(pDX, IDC_SAVEFILE, m_bSaveFile);
DDX_Check(pDX, IDC_OPENFILE, m_bOpenFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMyPropertyValRedu, CPropertyPage)
//{{AFX_MSG_MAP(CMyPropertyValRedu)
ON_BN_CLICKED(IDC_VIEW, OnView)
ON_BN_CLICKED(IDC_SAVEFILE, OnSavefile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
BOOL CMyPropertyComplete::OnInitDialog()
{
CPropertyPage::OnInitDialog();
m_iAlgorithm=0;
m_bSaveFile=false;
m_bOpenFile=true;
UpdateData(false);
GetDlgItem(IDC_PATHNAME)->EnableWindow(false);
GetDlgItem(IDC_VIEW)->EnableWindow(false);
TRACE("complete init: %d\n",m_bShow);
if(!m_bShow)
EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMyPropertyDiscrete::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_iAlgorithm=1;
m_bSaveFile=false;
m_bOpenFile=true;
UpdateData(false);
GetDlgItem(IDC_PATHNAME)->EnableWindow(false);
GetDlgItem(IDC_VIEW)->EnableWindow(false);
//EnableWindow(!m_bnotdis);
EnableWindow(m_bShow);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMyPropertyAttRedu::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_iAlgorithm=4;
m_bSaveFile=false;
m_bOpenFile=true;
UpdateData(false);
GetDlgItem(IDC_PATHNAME)->EnableWindow(false);
GetDlgItem(IDC_VIEW)->EnableWindow(false);
if(!m_bShow)
EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMyPropertyValRedu::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
m_iAlgorithm=0;
m_bSaveFile=false;
m_bOpenFile=true;
UpdateData(false);
GetDlgItem(IDC_PATHNAME)->EnableWindow(false);
GetDlgItem(IDC_VIEW)->EnableWindow(false);
if(!m_bShow)
EnableWindow(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMyPropertyComplete::OnSavefile()
{
UpdateData(true);
GetDlgItem(IDC_PATHNAME)->EnableWindow(m_bSaveFile);
GetDlgItem(IDC_VIEW)->EnableWindow(m_bSaveFile);
}
void CMyPropertyComplete::OnView()
{
UpdateData(true);
CFileDialog dlg(false,".txt",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"RS files(*.txt)|*.txt|all files(*.*)|*.*||",NULL);
if(dlg.DoModal()==IDOK)
{
m_strPathName=dlg.GetPathName();
UpdateData(false);
}
}
void CMyPropertyDiscrete::OnView()
{
UpdateData(true);
CFileDialog dlg(false,".txt",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"RS files(*.txt)|*.txt|all files(*.*)|*.*||",NULL);
if(dlg.DoModal()==IDOK)
{
m_strPathName=dlg.GetPathName();
UpdateData(false);
}
}
void CMyPropertyValRedu::OnView()
{
UpdateData(true);
CFileDialog dlg(false,".txt",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"RS files(*.txt)|*.txt|all files(*.*)|*.*||",NULL);
if(dlg.DoModal()==IDOK)
{
m_strPathName=dlg.GetPathName();
UpdateData(false);
}
}
void CMyPropertyAttRedu::OnView()
{
UpdateData(true);
CFileDialog dlg(false,".txt",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
"RS files(*.txt)|*.txt|all files(*.*)|*.*||",NULL);
if(dlg.DoModal()==IDOK)
{
m_strPathName=dlg.GetPathName();
UpdateData(false);
}
}
void CMyPropertyDiscrete::OnSavefile()
{
UpdateData(true);
GetDlgItem(IDC_PATHNAME)->EnableWindow(m_bSaveFile);
GetDlgItem(IDC_VIEW)->EnableWindow(m_bSaveFile);
}
void CMyPropertyValRedu::OnSavefile()
{
UpdateData(true);
GetDlgItem(IDC_PATHNAME)->EnableWindow(m_bSaveFile);
GetDlgItem(IDC_VIEW)->EnableWindow(m_bSaveFile);
}
void CMyPropertyAttRedu::OnSavefile()
{
UpdateData(true);
GetDlgItem(IDC_PATHNAME)->EnableWindow(m_bSaveFile);
GetDlgItem(IDC_VIEW)->EnableWindow(m_bSaveFile);
}
BOOL CMyPropertyComplete::OnKillActive()
{
UpdateData(true);
if(m_bSaveFile && m_strPathName.IsEmpty())
{
MessageBox("File Name can't be null!");
return false;
}
return CPropertyPage::OnKillActive();
}
BOOL CMyPropertyDiscrete::OnKillActive()
{
UpdateData(true);
if(m_bSaveFile && m_strPathName.IsEmpty())
{
MessageBox("File Name can't be null!");
return false;
}
return CPropertyPage::OnKillActive();
}
BOOL CMyPropertyValRedu::OnKillActive()
{
UpdateData(true);
if(m_bSaveFile && m_strPathName.IsEmpty())
{
MessageBox("File Name can't be null!");
return false;
}
return CPropertyPage::OnKillActive();
}
BOOL CMyPropertyAttRedu::OnKillActive()
{
UpdateData(true);
if(m_bSaveFile && m_strPathName.IsEmpty())
{
MessageBox("File Name can't be null!");
return false;
}
return CPropertyPage::OnKillActive();
}
void CMyPropertyComplete::EnableWindow(bool NewValue)
{
GetDlgItem(IDC_PATHNAME)->EnableWindow(NewValue);
GetDlgItem(IDC_ALGORITHM)->EnableWindow(NewValue);
GetDlgItem(IDC_SAVEFILE)->EnableWindow(NewValue);
GetDlgItem(IDC_VIEW)->EnableWindow(NewValue);
GetDlgItem(IDC_OPENFILE)->EnableWindow(NewValue);
}
void CMyPropertyDiscrete::EnableWindow(bool NewValue)
{
GetDlgItem(IDC_PATHNAME)->EnableWindow(NewValue);
GetDlgItem(IDC_ALGORITHM)->EnableWindow(NewValue);
GetDlgItem(IDC_SAVEFILE)->EnableWindow(NewValue);
GetDlgItem(IDC_VIEW)->EnableWindow(NewValue);
GetDlgItem(IDC_OPENFILE)->EnableWindow(NewValue);
}
void CMyPropertyValRedu::EnableWindow(bool NewValue)
{
GetDlgItem(IDC_PATHNAME)->EnableWindow(NewValue);
GetDlgItem(IDC_ALGORITHM)->EnableWindow(NewValue);
GetDlgItem(IDC_SAVEFILE)->EnableWindow(NewValue);
GetDlgItem(IDC_VIEW)->EnableWindow(NewValue);
GetDlgItem(IDC_OPENFILE)->EnableWindow(NewValue);
}
void CMyPropertyAttRedu::EnableWindow(bool NewValue)
{
GetDlgItem(IDC_PATHNAME)->EnableWindow(NewValue);
GetDlgItem(IDC_ALGORITHM)->EnableWindow(NewValue);
GetDlgItem(IDC_SAVEFILE)->EnableWindow(NewValue);
GetDlgItem(IDC_VIEW)->EnableWindow(NewValue);
GetDlgItem(IDC_OPENFILE)->EnableWindow(NewValue);
}
void CMyPropertyDiscrete::OnNotdisc()
{
UpdateData(true);
//EnableWindow(!m_bnotdis);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -