📄 setting.cpp
字号:
// Setting.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "Setting.h"
#include "CustomerDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Setting dialog
char* WChar2SChar(CString &s) ;
Setting::Setting(CWnd* pParent /*=NULL*/)
: CDialog(Setting::IDD, pParent)
{
//{{AFX_DATA_INIT(Setting)
m_GoldPrice = _T("");
m_ExchangeRate = _T("");
m_Fineness = _T("");
m_Currency = _T("");
m_MarkUp = _T("");
//}}AFX_DATA_INIT
}
void Setting::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Setting)
DDX_Text(pDX, COMBO_GoldPrice, m_GoldPrice);
DDX_Text(pDX, EDIT_ExchangeRate, m_ExchangeRate);
DDX_CBString(pDX, COMBO_Fineness, m_Fineness);
DDX_CBString(pDX, COMBO_Currency, m_Currency);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(Setting, CDialog)
//{{AFX_MSG_MAP(Setting)
ON_CBN_SELCHANGE(COMBO_Currency, OnSelchangeCurrency)
ON_BN_CLICKED(BUTTON_Confirm, OnConfirm)
ON_CBN_KILLFOCUS(COMBO_GoldPrice, OnKillfocusGoldPrice)
ON_CBN_KILLFOCUS(COMBO_MarkUp, OnKillfocusMarkUp)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Setting message handlers
void Setting::OnSelchangeCurrency()
{
// TODO: Add your control notification handler code here
//hkd --> usd *7.715
int index;
CString CSCurrency;
CComboBox * pCob=(CComboBox *) GetDlgItem(COMBO_Currency);
index=pCob->GetCurSel();
pCob->GetLBText(index,CSCurrency);
if (CSCurrency=="HKD")
{
SetDlgItemText(EDIT_ExchangeRate,L"1.000");
}
else if(CSCurrency=="USD")
{
SetDlgItemText(EDIT_ExchangeRate,L"7.715");
}
else if(CSCurrency=="GBP")
{
SetDlgItemText(EDIT_ExchangeRate,L"14.260");
}
else if(CSCurrency=="AUD")
{
SetDlgItemText(EDIT_ExchangeRate,L"5.460");
}
else if(CSCurrency=="EURO")
{
SetDlgItemText(EDIT_ExchangeRate,L"9.436");
}
else if(CSCurrency=="CHF")
{
SetDlgItemText(EDIT_ExchangeRate,L"5.930");
}
}
BOOL Setting::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
SetDlgItemText(COMBO_GoldPrice,L"550.00");
CComboBox* pFineness = (CComboBox*) GetDlgItem(COMBO_Fineness);
pFineness->SetCurSel(2);
SetDlgItemText(COMBO_MarkUp,L"2.00");
CComboBox* pCurrency = (CComboBox*) GetDlgItem(COMBO_Currency);
pCurrency->SetCurSel(0);
SetDlgItemText(EDIT_ExchangeRate,L"1.000");
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void Setting::OnConfirm()
{
// TODO: Add your control notification handler code here
GetDlgItemText(COMBO_GoldPrice,m_GoldPrice);
GetDlgItemText(COMBO_Fineness,m_Fineness);
GetDlgItemText(COMBO_MarkUp,m_MarkUp);
GetDlgItemText(COMBO_Currency,m_Currency);
GetDlgItemText(EDIT_ExchangeRate,m_ExchangeRate);
//AfxMessageBox(m_GoldPrice);
SendMessage(WM_CLOSE);
}
void Setting::OnKillfocusGoldPrice()
{
// TODO: Add your control notification handler code here
CString m_Edit;
CString CSCurrGoldPrice;
double dblCurrGoldPrice;
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -