📄 pagedata.cpp
字号:
// Pagedata.cpp : implementation file
//
#include "stdafx.h"
#include "Wediter.h"
#include "Pagedata.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPagedata property page
IMPLEMENT_DYNCREATE(CPagedata, CPropertyPage)
CPagedata::CPagedata() : CPropertyPage(CPagedata::IDD)
{
//{{AFX_DATA_INIT(CPagedata)
m_char = _T("");
m_word = _T("");
//}}AFX_DATA_INIT
}
CPagedata::~CPagedata()
{
}
void CPagedata::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPagedata)
DDX_Text(pDX, IDC_EDITCHAR, m_char);
DDX_Text(pDX, IDC_EDITWORD, m_word);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPagedata, CPropertyPage)
//{{AFX_MSG_MAP(CPagedata)
ON_EN_CHANGE(IDC_EDITCHAR, OnChangeEditchar)
ON_EN_CHANGE(IDC_EDITWORD, OnChangeEditword)
ON_BN_CLICKED(IDC_BUTTONCHAR, OnButtonchar)
ON_BN_CLICKED(IDC_BUTTONWORD, OnButtonword)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPagedata message handlers
void CPagedata::OnChangeEditchar()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CPropertyPage::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
Setapplay();
}
void CPagedata::OnChangeEditword()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CPropertyPage::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
Setapplay();
}
void CPagedata::OnButtonchar()
{
// TODO: Add your control notification handler code here
CString mstr;
mstr=Getfilepthname();
if(!mstr.IsEmpty())
{
CEdit* pedit=(CEdit*)
GetDescendantWindow(IDC_EDITCHAR);
if(pedit)
pedit->SetWindowText(mstr);
pedit=NULL;
delete pedit;
}
}
void CPagedata::OnButtonword()
{
// TODO: Add your control notification handler code here
CString mstr;
mstr=Getfilepthname();
if(!mstr.IsEmpty())
{
CEdit* pedit=(CEdit*)
GetDescendantWindow(IDC_EDITWORD);
if(pedit)
pedit->SetWindowText(mstr);
pedit=NULL;
delete pedit;
}
}
CString CPagedata::Getfilepthname()
{
static char BASED_CODE szFilter[] = "词库文件 (*.dat)|*.dat|文本文件 (*.txt)|*.txt||";
CString mstr;
//第一个参数为TRUE,保证为打开文件| OFN_OVERWRITEPROMPT
CFileDialog dlg(TRUE,NULL,NULL,OFN_HIDEREADONLY ,szFilter,NULL);
if(dlg.DoModal() == IDOK)
mstr=dlg.GetPathName();
else
mstr.IsEmpty();
delete dlg;
return mstr;
}
void CPagedata::Setapplay()
{
CButton* papply=(CButton*)
GetParent()->GetDescendantWindow(ID_APPLY_NOW);
if(papply)
papply->EnableWindow(TRUE);
papply=NULL;
delete papply;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -