📄 calculatordlg.cpp
字号:
// CalculatorDlg.cpp : implementation file
//
#include "stdafx.h"
#include "HrSys.h"
#include "CalculatorDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCalculatorDlg dialog
CCalculatorDlg::CCalculatorDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCalculatorDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCalculatorDlg)
m_Formula = _T("");
//}}AFX_DATA_INIT
}
void CCalculatorDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCalculatorDlg)
DDX_Text(pDX, IDC_FORMULA_EDIT, m_Formula);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCalculatorDlg, CDialog)
//{{AFX_MSG_MAP(CCalculatorDlg)
ON_BN_CLICKED(IDC_0_BUTTON, On0Button)
ON_BN_CLICKED(IDC_1_BUTTON, On1Button)
ON_BN_CLICKED(IDC_2_BUTTON, On2Button)
ON_BN_CLICKED(IDC_3_BUTTON, On3Button)
ON_BN_CLICKED(IDC_4_BUTTON, On4Button)
ON_BN_CLICKED(IDC_5_BUTTON, On5Button)
ON_BN_CLICKED(IDC_6_BUTTON, On6Button)
ON_BN_CLICKED(IDC_7_BUTTON, On7Button)
ON_BN_CLICKED(IDC_8_BUTTON, On8Button)
ON_BN_CLICKED(IDC_9_BUTTON, On9Button)
ON_BN_CLICKED(IDC_BASE_BUTTON, OnBaseButton)
ON_BN_CLICKED(IDC_F1_BUTTON, OnF1Button)
ON_BN_CLICKED(IDC_F2_BUTTON, OnF2Button)
ON_BN_CLICKED(IDC_F3_BUTTON, OnF3Button)
ON_BN_CLICKED(IDC_F4_BUTTON, OnF4Button)
ON_BN_CLICKED(IDC_F5_BUTTON, OnF5Button)
ON_BN_CLICKED(IDC_F6_BUTTON, OnF6Button)
ON_BN_CLICKED(IDC_P_BUTTON, OnPButton)
ON_BN_CLICKED(IDC_RESET_BUTTON, OnResetButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCalculatorDlg message handlers
void CCalculatorDlg::On0Button()
{
// TODO: Add your control notification handler code here
// 数字0
m_Formula = m_Formula + "0";
UpdateData(FALSE);
}
void CCalculatorDlg::On1Button()
{
// 数字1
m_Formula = m_Formula + "1";
UpdateData(FALSE);
}
void CCalculatorDlg::On2Button()
{
// TODO: Add your control notification handler code here
// 数字2
m_Formula = m_Formula + "2";
UpdateData(FALSE);
}
void CCalculatorDlg::On3Button()
{
// TODO: Add your control notification handler code here
// 数字3
m_Formula = m_Formula + "3";
UpdateData(FALSE);
}
void CCalculatorDlg::On4Button()
{
// TODO: Add your control notification handler code here
// 数字4
m_Formula = m_Formula + "4";
UpdateData(FALSE);
}
void CCalculatorDlg::On5Button()
{
// TODO: Add your control notification handler code here
// 数字5
m_Formula = m_Formula + "5";
UpdateData(FALSE);
}
void CCalculatorDlg::On6Button()
{
// TODO: Add your control notification handler code here
// 数字6
m_Formula = m_Formula + "6";
UpdateData(FALSE);
}
void CCalculatorDlg::On7Button()
{
// TODO: Add your control notification handler code here
// 数字7
m_Formula = m_Formula + "7";
UpdateData(FALSE);
}
void CCalculatorDlg::On8Button()
{
// TODO: Add your control notification handler code here
// 数字8
m_Formula = m_Formula + "8";
UpdateData(FALSE);
}
void CCalculatorDlg::On9Button()
{
// TODO: Add your control notification handler code here
// 数字9
m_Formula = m_Formula + "9";
UpdateData(FALSE);
}
void CCalculatorDlg::OnBaseButton()
{
// 基本工资字段
m_Formula = m_Formula + "基本工资";
UpdateData(FALSE);
}
void CCalculatorDlg::OnF1Button()
{
// 加号
m_Formula = m_Formula + "+";
UpdateData(FALSE);
}
void CCalculatorDlg::OnF2Button()
{
// TODO: Add your control notification handler code here
// 减号
m_Formula = m_Formula + "-";
UpdateData(FALSE);
}
void CCalculatorDlg::OnF3Button()
{
// TODO: Add your control notification handler code here
// 乘号
m_Formula = m_Formula + "*";
UpdateData(FALSE);
}
void CCalculatorDlg::OnF4Button()
{
// TODO: Add your control notification handler code here
// 除号
m_Formula = m_Formula + "/";
}
void CCalculatorDlg::OnF5Button()
{
// TODO: Add your control notification handler code here
// (
m_Formula = m_Formula + "(";
UpdateData(FALSE);
}
void CCalculatorDlg::OnF6Button()
{
// TODO: Add your control notification handler code here
// )
m_Formula = m_Formula + ")";
UpdateData(FALSE);
}
void CCalculatorDlg::OnPButton()
{
// TODO: Add your control notification handler code here
// 小数点
m_Formula = m_Formula + ".";
UpdateData(FALSE);
}
void CCalculatorDlg::OnResetButton()
{
// TODO: Add your control notification handler code here
m_Formula = "";
UpdateData(FALSE);
}
void CCalculatorDlg::OnOK()
{
cFormula = m_Formula;
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -