📄 cop.cpp
字号:
// COP.cpp : implementation file
//
#include "stdafx.h"
#include "Calculator.h"
#include "COP.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCOP dialog
CCOP::CCOP(CWnd* pParent /*=NULL*/)
: CDialog(CCOP::IDD, pParent)
{
//{{AFX_DATA_INIT(CCOP)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CCOP::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCOP)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCOP, CDialog)
//{{AFX_MSG_MAP(CCOP)
ON_BN_CLICKED(IDC_BTN_ADD, OnBtnAdd)
ON_BN_CLICKED(IDC_BTN_MIN, OnBtnMin)
ON_BN_CLICKED(IDC_BTN_MUL, OnBtnMul)
ON_BN_CLICKED(IDC_BTN_DIV, OnBtnDiv)
ON_BN_CLICKED(IDC_BTN_POW, OnBtnPow)
ON_BN_CLICKED(IDC_BTN_MOD, OnBtnMod)
ON_BN_CLICKED(IDC_BTN_LBRA, OnBtnLbra)
ON_BN_CLICKED(IDC_BTN_RBRA, OnBtnRbra)
ON_WM_SETCURSOR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCOP message handlers
BOOL CCOP::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
UINT n=pWnd->GetDlgCtrlID();
if(n==IDC_BTN_POW)
{
m_toolTip.ShowToolTip( n );
m_nCtrlIDTmp=n;
return 1;
}
else if(n==IDC_BTN_MOD)
{
m_toolTip.ShowToolTip( n );
m_nCtrlIDTmp=n;
return 1;
}
m_toolTip.ErasePreviousToolTipDisplay(m_nCtrlIDTmp);
return CDialog::OnSetCursor(pWnd, nHitTest, message);
}
void CCOP::OnCancel()
{
m_strN="OVER";
CDialog::OnCancel();
}
void CCOP::OnBtnAdd()
{
m_strN="+";
}
void CCOP::OnBtnMin()
{
m_strN="-";
}
void CCOP::OnBtnMul()
{
m_strN="*";
}
void CCOP::OnBtnDiv()
{
m_strN="/";
}
void CCOP::OnBtnPow()
{
m_strN="^";
}
void CCOP::OnBtnMod()
{
m_strN="%";
}
void CCOP::OnBtnLbra()
{
m_strN="(";
}
void CCOP::OnBtnRbra()
{
m_strN=")";
}
BOOL CCOP::OnInitDialog()
{
CDialog::OnInitDialog();
m_toolTip.Create( this );
CStringArray straInfo;
straInfo.RemoveAll();
straInfo.Add( "x的y次方" );
m_toolTip.AddControlInfo( IDC_BTN_POW, straInfo, RGB(255,255,0) );
straInfo.RemoveAll();
straInfo.Add( "x模y" );
m_toolTip.AddControlInfo( IDC_BTN_MOD, straInfo, RGB(255,255,0) );
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -