113 lines
2.4 KiB
C++
113 lines
2.4 KiB
C++
|
|
|||
|
// FunDlg.cpp : <20><><EFBFBD>@<40><>
|
|||
|
//
|
|||
|
|
|||
|
|
|||
|
#include "stdafx.h"
|
|||
|
#include "TestSimulator.h"
|
|||
|
#include "FunDlg.h"
|
|||
|
#include "afxdialogex.h"
|
|||
|
|
|||
|
|
|||
|
#ifdef _DEBUG
|
|||
|
#define new DEBUG_NEW
|
|||
|
#endif
|
|||
|
|
|||
|
#define NO_OPER_FLAG -11 //<2F><><EFBFBD>s<EFBFBD>b<EFBFBD>B<EFBFBD>⤸
|
|||
|
|
|||
|
#define PLUS 1 // + flag
|
|||
|
#define MINUS 2 // - flag
|
|||
|
#define MULTI 3 // * flag
|
|||
|
#define DIV 4 // / flag
|
|||
|
|
|||
|
|
|||
|
CFunDlg::CFunDlg (CWnd* pParent)
|
|||
|
: CDialogEx (CFunDlg::IDD, pParent)
|
|||
|
{
|
|||
|
m_hIcon = AfxGetApp ()->LoadIcon (IDR_MAINFRAME);
|
|||
|
m_iOperFlag = NO_OPER_FLAG;
|
|||
|
}
|
|||
|
|
|||
|
CFunDlg::~CFunDlg ()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
BEGIN_MESSAGE_MAP (CFunDlg, CDialogEx)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_PLUS, &CFunDlg::OnBnClickedButtonPlus)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_MINUS, &CFunDlg::OnBnClickedButtonMinus)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_MULTI, &CFunDlg::OnBnClickedButtonMulti)
|
|||
|
ON_BN_CLICKED(IDC_BUTTON_DIV, &CFunDlg::OnBnClickedButtonDiv)
|
|||
|
END_MESSAGE_MAP ()
|
|||
|
|
|||
|
|
|||
|
void CFunDlg::DoDataExchange (CDataExchange* pDX)
|
|||
|
{
|
|||
|
CDialogEx::DoDataExchange (pDX);
|
|||
|
}
|
|||
|
|
|||
|
BOOL CFunDlg::OnInitDialog ()
|
|||
|
{
|
|||
|
CDialogEx::OnInitDialog ();
|
|||
|
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetReadOnly ();
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>l<EFBFBD>Ʈ<EFBFBD>Ū<EFBFBD><C5AA><EFBFBD>B<EFBFBD>⤸flag<61>A<EFBFBD>ñN<C3B1><4E><EFBFBD><EFBFBD><EFBFBD>ܩ<EFBFBD>Edit<69><74>
|
|||
|
switch (m_iOperFlag)
|
|||
|
{
|
|||
|
case PLUS:
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("+"));
|
|||
|
break;
|
|||
|
case MINUS:
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("-"));
|
|||
|
break;
|
|||
|
case MULTI:
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("*"));
|
|||
|
break;
|
|||
|
case DIV:
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("/"));
|
|||
|
break;
|
|||
|
default:
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("Please select operator"));
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
return TRUE;
|
|||
|
}
|
|||
|
|
|||
|
int CFunDlg::GetOperFlag () const
|
|||
|
{
|
|||
|
return m_iOperFlag;
|
|||
|
}
|
|||
|
|
|||
|
void CFunDlg::SetOperFlag (int iOperFlag)
|
|||
|
{
|
|||
|
m_iOperFlag = iOperFlag;
|
|||
|
}
|
|||
|
|
|||
|
void CFunDlg::OnBnClickedButtonPlus ()
|
|||
|
{
|
|||
|
m_iOperFlag = PLUS; //<2F><><EFBFBD>U+<2B><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>PLUS
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("+"));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CFunDlg::OnBnClickedButtonMinus ()
|
|||
|
{
|
|||
|
m_iOperFlag = MINUS; //<2F><><EFBFBD>U-<2D><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>MINUS
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("-"));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CFunDlg::OnBnClickedButtonMulti ()
|
|||
|
{
|
|||
|
m_iOperFlag = MULTI; //<2F><><EFBFBD>U*<2A><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>MULTI
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("*"));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
void CFunDlg::OnBnClickedButtonDiv ()
|
|||
|
{
|
|||
|
m_iOperFlag = DIV; //<2F><><EFBFBD>U/<2F><><EFBFBD>]<5D>w<EFBFBD><77><EFBFBD>J<EFBFBD>i<EFBFBD><69>flag<61><67>DIV
|
|||
|
( (CEdit* ) GetDlgItem (IDC_EDIT_OPERATOR))->SetWindowTextA (_T ("/"));
|
|||
|
}
|