📄 keymodify.cpp
字号:
// KeyModify.cpp : implementation file
//
#include "stdafx.h"
#include "MoinorCentre.h"
#include "KeyModify.h"
#include "UserDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CKeyModify dialog
CKeyModify::CKeyModify(CWnd* pParent /*=NULL*/)
: CDialog(CKeyModify::IDD, pParent)
{
//{{AFX_DATA_INIT(CKeyModify)
m_oldkey = _T("");
m_newkey = _T("");
m_newkeyfix = _T("");
//}}AFX_DATA_INIT
}
void CKeyModify::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CKeyModify)
DDX_Text(pDX, IDC_EDIT1, m_oldkey);
DDX_Text(pDX, IDC_EDIT2, m_newkey);
DDX_Text(pDX, IDC_EDIT3, m_newkeyfix);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CKeyModify, CDialog)
//{{AFX_MSG_MAP(CKeyModify)
ON_WM_CTLCOLOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CKeyModify message handlers
void CKeyModify::OnOK()
{this->UpdateData();
if(m_oldkey!=((CUserDialog*)GetParent())->m_user.m_userkey)
AfxMessageBox("原密码输入错误请重新输入");
else
{if(m_newkey!=m_newkeyfix)
AfxMessageBox("两次输入密码不同请重新输入");
else
{((CUserDialog*)GetParent())->m_user.Edit();
((CUserDialog*)GetParent())->m_user.m_userkey=m_newkey;
((CUserDialog*)GetParent())->m_user.Update();
AfxMessageBox("密码修改成功");
CDialog::OnOK();
}
}
// TODO: Add extra validation here
}
HBRUSH CKeyModify::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG)
{
return m_brush;
}
if(nCtlColor == CTLCOLOR_STATIC)
{ pDC->SetBkMode(0);
pDC->SetTextColor(RGB(255,100,70));
hbr = (HBRUSH)::GetStockObject(NULL_BRUSH);
return hbr;
}
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CKeyModify::OnInitDialog()
{
CDialog::OnInitDialog();
CDib beijing;
beijing.Load(".//res//dd.bmp");
CRect ff;
GetWindowRect(ff);
beijing.ChangeImageSize(ff.Width(),ff.Height());
m_brush.CreateDIBPatternBrush(beijing.m_hDib,DIB_PAL_COLORS);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -