📄 makeassetdlg.cpp
字号:
// MakeAssetDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MoneyAnyWhere.h"
#include "MakeAssetDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMakeAssetDlg dialog
CMakeAssetDlg::CMakeAssetDlg(CWnd* pParent /*=NULL*/)
: CDialog(CMakeAssetDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CMakeAssetDlg)
m_strMoneyType = _T("");
m_iAssetAmount = 0;
m_strAssetName = _T("");
//}}AFX_DATA_INIT
}
void CMakeAssetDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMakeAssetDlg)
DDX_Control(pDX, IDC_COMBO_MONEYTYPE, m_ctrComboBox);
DDX_CBString(pDX, IDC_COMBO_MONEYTYPE, m_strMoneyType);
DDX_Text(pDX, IDC_EDIT_ASSETAMOUNT, m_iAssetAmount);
DDX_Text(pDX, IDC_EDIT_ASSETNAME, m_strAssetName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMakeAssetDlg, CDialog)
//{{AFX_MSG_MAP(CMakeAssetDlg)
ON_BN_CLICKED(IDC_BTN_ASSETCANCEL, OnBtnAssetcancel)
ON_BN_CLICKED(IDC_BTN_ASSETHELP, OnBtnAssethelp)
ON_BN_CLICKED(IDC_BTN_ASSETOK, OnBtnAssetok)
ON_EN_SETFOCUS(IDC_EDIT_ASSETAMOUNT, OnSetfocusEditAssetamount)
ON_EN_KILLFOCUS(IDC_EDIT_ASSETAMOUNT, OnKillfocusEditAssetamount)
ON_EN_SETFOCUS(IDC_EDIT_ASSETNAME, OnSetfocusEditAssetname)
ON_EN_KILLFOCUS(IDC_EDIT_ASSETNAME, OnKillfocusEditAssetname)
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMakeAssetDlg message handlers
void CMakeAssetDlg::OnBtnAssetcancel()
{
// TODO: Add your control notification handler code here
CDialog::OnCancel();
}
void CMakeAssetDlg::OnBtnAssethelp()
{
// TODO: Add your control notification handler code here
AfxMessageBox(L"这个是帮助");
}
void CMakeAssetDlg::OnBtnAssetok()
{
UpdateData(true);
GetDlgItemText(IDC_DATETIMEPICKER_CASHTIME,m_strAssetBeginTime);
CDialog::OnOK();
// TODO: Add your control notification handler code here
}
BOOL CMakeAssetDlg::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
}
/*************************************************
函数功能:初始化INI文件
-------------------------------------------------
修改时间:2005-3-15
修改人: Tony
修改内容:m_pMoneyTypeIni和m_pMoneyTypeIni的初始化,同时将信息增加到ComboBox中
*************************************************/
BOOL CMakeAssetDlg::Init()
{
//m_ctrComboBox.DeleteAllItems();
m_pMoneyTypeIni = new CIniReader(L"\\Program Files\\理财能手\\Data\\MoneyType.ini");
m_pMoneyTypeIni2 = new CIniReader(L"\\Program Files\\理财能手\\Data\\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 MoneyType.ini");
delete m_pMoneyTypeIni2;
m_pMoneyTypeIni2 = NULL;
return FALSE;
}
if(! m_pMoneyTypeIni2->Parse())
{
::AfxMessageBox(L"Invalid format :MoneyType.ini");
delete m_pMoneyTypeIni2;
m_pMoneyTypeIni2 = NULL;
return FALSE;
}
//AfxMessageBox(m_pAccountIni->GetFilePath());
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;
// Get key ( string ) and value ( string )
Info.m_item.GetNextAssoc(pos, key, value);
if(key == "name")
strType = value ;
}
m_ctrComboBox.InsertString(i,strType);
}
}
void CMakeAssetDlg::OnSetfocusEditAssetamount()
{
SHSipPreference(m_hWnd, SIP_UP);
// TODO: Add your control notification handler code here
}
void CMakeAssetDlg::OnKillfocusEditAssetamount()
{
SHSipPreference(m_hWnd, SIP_DOWN);
// TODO: Add your control notification handler code here
}
void CMakeAssetDlg::OnSetfocusEditAssetname()
{
SHSipPreference(m_hWnd, SIP_UP);
// TODO: Add your control notification handler code here
}
void CMakeAssetDlg::OnKillfocusEditAssetname()
{
SHSipPreference(m_hWnd, SIP_DOWN);
// TODO: Add your control notification handler code here
}
void CMakeAssetDlg::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 + -