📄 makesavingdlg.cpp
字号:
// MakeSavingDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MoneyAnyWhere.h"
#include "MakeSavingDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMakeSavingDlg dialog
CMakeSavingDlg::CMakeSavingDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMakeSavingDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMakeSavingDlg)
m_strBankInterest = _T("");
m_strSavingName = _T("");
m_strMoneyType = _T("");
m_iSavingAmount = 0;
m_strBankName = _T("");
//}}AFX_DATA_INIT
}
void CMakeSavingDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeSavingDlg)
DDX_Control(pDX, IDC_COMBO_BANKNAME, m_ctrComBox2);
DDX_Control(pDX, IDC_COMBO_MONEYTYPE, m_ctrComBox);
DDX_Text(pDX, IDC_EDIT_BANKINTEREST, m_strBankInterest);
DDX_Text(pDX, IDC_EDIT_SAVINGNAME, m_strSavingName);
DDX_CBString(pDX, IDC_COMBO_MONEYTYPE, m_strMoneyType);
DDX_Text(pDX, IDC_EDIT_SAVINGAMOUNT, m_iSavingAmount);
DDX_CBString(pDX, IDC_COMBO_BANKNAME, m_strBankName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMakeSavingDlg, CDialog)
//{{AFX_MSG_MAP(CMakeSavingDlg)
ON_BN_CLICKED(IDC_BTN_SAVINGHELP, OnBtnSavinghelp)
ON_BN_CLICKED(IDC_BTN_SAVINGOK, OnBtnSavingok)
ON_BN_CLICKED(IDC_BTN_SAVINGCANCEL, OnBtnSavingcancel)
ON_EN_SETFOCUS(IDC_EDIT_BANKINTEREST, OnSetfocusEditBankinterest)
ON_EN_KILLFOCUS(IDC_EDIT_BANKINTEREST, OnKillfocusEditBankinterest)
ON_EN_SETFOCUS(IDC_EDIT_SAVINGAMOUNT, OnSetfocusEditSavingamount)
ON_EN_KILLFOCUS(IDC_EDIT_SAVINGAMOUNT, OnKillfocusEditSavingamount)
ON_EN_SETFOCUS(IDC_EDIT_SAVINGNAME, OnSetfocusEditSavingname)
ON_EN_KILLFOCUS(IDC_EDIT_SAVINGNAME, OnKillfocusEditSavingname)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMakeSavingDlg message handlers
void CMakeSavingDlg::OnBtnSavinghelp()
{
AfxMessageBox(L"这个是帮助");
}
void CMakeSavingDlg::OnBtnSavingok()
{
UpdateData(true);
GetDlgItemText(IDC_DATETIMEPICKER_SAVINGTIME,m_strSavingBeginTime);
CDialog::OnOK();
}
void CMakeSavingDlg::OnBtnSavingcancel()
{
CDialog::OnCancel();
}
/*************************************************
函数功能:初始化INI文件
-------------------------------------------------
修改时间:2005-3-10
修改人: 宋雷
修改内容:m_pMoneyTypeIni和m_pMoneyTypeIni的初始化,同时将信息增加到ComboBox中
*************************************************/
BOOL CMakeSavingDlg::Init()
{
//m_ctrComboBox.DeleteAllItems();
//m_pMoneyTypeIni = new CIniReader(L"\\Program Files\\理财能手\\Data\\MoneyType.ini");
//m_pMoneyTypeIni2 = new CIniReader(L"\\Program Files\\理财能手\\Data\\MoneyType.ini");
m_pMoneyTypeIni = new CIniReader(L"MoneyType.ini");
m_pMoneyTypeIni2 = new CIniReader(L"MoneyType.ini");
CString strType;
//装载和解析INI文件
if(! m_pMoneyTypeIni->Load())
{
::AfxMessageBox(L"Can not load ini");
delete m_pMoneyTypeIni;
m_pMoneyTypeIni = NULL;
return FALSE;
}
if(! m_pMoneyTypeIni->Parse())
{
::AfxMessageBox(L"Invalid format ");
delete m_pMoneyTypeIni;
m_pMoneyTypeIni = NULL;
return FALSE;
}
CSection TypeInfo= (*m_pMoneyTypeIni)[L"Info"];
POSITION _pos = TypeInfo.m_item.GetStartPosition();
while( _pos != NULL)
{
String _key;
String _value;
TypeInfo.m_item.GetNextAssoc(_pos, _key, _value);
if((CString)_key==(CString)"Moneytype_count") //获得该现金帐户一共有多少笔交易
{
m_iTypeCount = _wtoi(_value);
}
}
if(! m_pMoneyTypeIni2->Load())
{
::AfxMessageBox(L"Can not load Account.ini");
delete m_pMoneyTypeIni2;
m_pMoneyTypeIni2 = NULL;
return FALSE;
}
if(! m_pMoneyTypeIni2->Parse())
{
::AfxMessageBox(L"Invalid format :Account.ini");
delete m_pMoneyTypeIni2;
m_pMoneyTypeIni2 = NULL;
return FALSE;
}
for(int i=0;i<m_iTypeCount;i++)
{
CString str;
str.Format(L"%d",i);
CSection Info= (*m_pMoneyTypeIni2)[str];
POSITION pos = Info.m_item.GetStartPosition();
while( pos != NULL )
{
String key;
String value;
Info.m_item.GetNextAssoc(pos, key, value);
if(key == "name")
strType = value ;
}
m_ctrComBox.InsertString(i,strType);
}
/////////////////////////////////////////////////////////////////////////////
//读银行的名称
//m_pBankNameIni = new CIniReader(L"\\Program Files\\理财能手\\Data\\BankName.ini");
//m_pBankNameIni2 = new CIniReader(L"\\Program Files\\理财能手\\Data\\BankName.ini");
m_pBankNameIni = new CIniReader(L"BankName.ini");
m_pBankNameIni2 = new CIniReader(L"BankName.ini");
//CString strType;
//装载和解析INI文件
if(! m_pBankNameIni->Load())
{
::AfxMessageBox(L"Can not load ini");
delete m_pBankNameIni;
m_pBankNameIni = NULL;
return FALSE;
}
if(! m_pBankNameIni->Parse())
{
::AfxMessageBox(L"Invalid format ");
delete m_pBankNameIni;
m_pBankNameIni = NULL;
return FALSE;
}
/*CSection*/ TypeInfo= (*m_pBankNameIni)[L"Info"];
/*POSITION*/ _pos = TypeInfo.m_item.GetStartPosition();
while( _pos != NULL)
{
String _key;
String _value;
TypeInfo.m_item.GetNextAssoc(_pos, _key, _value);
if((CString)_key==(CString)"BankName_count") //获得该现金帐户一共有多少笔交易
{
m_iTypeCount = _wtoi(_value);
}
}
if(! m_pBankNameIni2->Load())
{
::AfxMessageBox(L"Can not load Account.ini");
delete m_pBankNameIni2;
m_pBankNameIni2 = NULL;
return FALSE;
}
if(! m_pBankNameIni2->Parse())
{
::AfxMessageBox(L"Invalid format :Account.ini");
delete m_pBankNameIni2;
m_pBankNameIni2 = NULL;
return FALSE;
}
for(i=0;i<m_iTypeCount;i++)
{
CString str;
str.Format(L"%d",i);
CSection Info= (*m_pBankNameIni2)[str];
POSITION pos = Info.m_item.GetStartPosition();
while( pos != NULL )
{
String key;
String value;
Info.m_item.GetNextAssoc(pos, key, value);
if(key == "name")
strType = value ;
}
m_ctrComBox2.InsertString(i,strType);
}
}
BOOL CMakeSavingDlg::OnInitDialog()
{
CDialog::OnInitDialog();
if(!Init())
return false;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMakeSavingDlg::OnSetfocusEditBankinterest()
{
SHSipPreference(m_hWnd, SIP_UP);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnKillfocusEditBankinterest()
{
SHSipPreference(m_hWnd, SIP_DOWN);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnSetfocusEditSavingamount()
{
SHSipPreference(m_hWnd, SIP_UP);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnKillfocusEditSavingamount()
{
SHSipPreference(m_hWnd, SIP_DOWN);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnSetfocusEditSavingname()
{
SHSipPreference(m_hWnd, SIP_UP);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnKillfocusEditSavingname()
{
SHSipPreference(m_hWnd, SIP_DOWN);
// TODO: Add your control notification handler code here
}
void CMakeSavingDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
CRect rect;
this->GetClientRect(&rect);
CBrush *pBrush = new CBrush(COLORREF(RGB(227,234,206)));
dc.FillRect(rect,pBrush);
dc.SetBkColor(COLORREF(RGB(227,234,206)));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -