亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? calculatordlg.cpp

?? 實現windows自帶計算器功能
?? CPP
字號:
// CalculatorDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Calculator.h"
#include "CalculatorDlg.h"
#include "math.h"  


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();
    
    // Dialog Data
    
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCalculatorDlg dialog

CCalculatorDlg::CCalculatorDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCalculatorDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCalculatorDlg)


	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_display = 0;
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
    m_hAccel = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDD));
}

void CCalculatorDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCalculatorDlg)
	DDX_Text(pDX, IDC_EDIT1, m_display);

	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CCalculatorDlg, CDialog)
	//{{AFX_MSG_MAP(CCalculatorDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
    ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
	ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
	ON_BN_CLICKED(IDC_BUTTON6, OnButton6)
	ON_BN_CLICKED(IDC_BUTTON7, OnButton7)
	ON_BN_CLICKED(IDC_BUTTON8, OnButton8)
	ON_BN_CLICKED(IDC_BUTTON9, OnButton9)
	ON_BN_CLICKED(IDC_BUTTON10, OnButton10)
	ON_BN_CLICKED(IDC_BUTTONADD, OnButtonadd)
	ON_BN_CLICKED(IDC_BUTTONSUB, OnButtonsub)
	ON_BN_CLICKED(IDC_BUTTONMUT, OnButtonmut)
	ON_BN_CLICKED(IDC_BUTTONDIV, OnButtondiv)
	ON_BN_CLICKED(IDC_BUTTONEQU, OnButtonequ)
	ON_BN_CLICKED(ID_CE, OnCe)
	ON_BN_CLICKED(IDC_BUTTONDOT, OnButtondot)
	ON_COMMAND(ID_FILE_EXIT, OnFileExit)
	ON_COMMAND(ID_HELP_ABOUT, OnHelpAbout)
	ON_BN_CLICKED(ID_C, OnC)
	ON_BN_CLICKED(IDC_BUTTONSQRT, OnButtonsqrt)
	ON_BN_CLICKED(IDC_BUTTONSIGN, OnButtonSIGN)
	ON_BN_CLICKED(IDC_BUTTONRec, OnBUTTONRec)
	ON_BN_CLICKED(IDC_BUTTONPER, OnButtonper)
	ON_BN_CLICKED(IDC_BIANHUAN, OnBianhuan)
	ON_BN_CLICKED(IDC_BUTTONEXP, OnButtonexp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCalculatorDlg message handlers

BOOL CCalculatorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	SetWindowText("calculator");
	
	// TODO: Add extra initialization here

	//變量初始化
    OnC();

    //加載菜單項
	m_menu.LoadMenu(IDR_MENU1);
	SetMenu(&m_menu);
	m_menu.Detach();

	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CCalculatorDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CCalculatorDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CCalculatorDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

HBRUSH CCalculatorDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	pDC->SetBkMode(TRANSPARENT);
	pDC->SetTextColor(RGB(255,255,255));
	hbr=CreateSolidBrush(RGB(0,0,0));
	// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CCalculatorDlg::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	//::	SetCursor(LoadCursor(,LPCSTR(IDC_CURSOR1)));
	CDialog::OnMouseMove(nFlags, point);
}

void CCalculatorDlg::KeyDeal(int a)  //處理數字按鈕
{
	if(m_dot)
	{
		m_end = m_end + point * a;
        point /= 10;
	}
	else	m_end = m_end*10 + a;
	m_display = m_end;
    UpdateData(FALSE);  //將結果顯示在編輯器中
}

void CCalculatorDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(1);
}

void CCalculatorDlg::OnButton2() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(2);
}

void CCalculatorDlg::OnButton3() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(3);
}

void CCalculatorDlg::OnButton4() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(4);
}

void CCalculatorDlg::OnButton5() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(5);
}

void CCalculatorDlg::OnButton6() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(6);
}

void CCalculatorDlg::OnButton7() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(7);
}

void CCalculatorDlg::OnButton8() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(8);
}

void CCalculatorDlg::OnButton9() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(9);
}

void CCalculatorDlg::OnButton10() 
{
	// TODO: Add your control notification handler code here
	KeyDeal(0);
}

void CCalculatorDlg::OnButtondot() 
{
	// TODO: Add your control notification handler code here
        if(!m_dot)     //判斷dot是否已按下過
        {
			m_dot=1;
            point=0.1;
		}
}

void CCalculatorDlg::Result()
{
	switch(m_bit)
	{
	case 1:// "+"
		m_base += m_end;
		break;
    case 2:// "-"
		m_base -= m_end;
		break;
	case 3:// "*"
		m_base *= m_end;
		break;
	case 4:// "/"
		if(m_end==0)
		{
			MessageBox("除數為0!");
			OnC();
			return;
		}
		m_base /= m_end;
		break;
	default:
		m_base = m_end;
		break;
	}
	m_end = 0;
	m_dot = 0;
	m_display = m_base;
	UpdateData(FALSE);
}

void CCalculatorDlg::OnButtonadd()   //加號運算符
{
	// TODO: Add your control notification handler code here
	Result();  //求值
	m_bit = 1;
}

void CCalculatorDlg::OnButtonsub()   //減號運算符
{
	// TODO: Add your control notification handler code here
    Result();  //求值
	m_bit = 2;
}

void CCalculatorDlg::OnButtonmut()   //乘號運算符
{
	// TODO: Add your control notification handler code here
	Result();  //記錄
	m_bit =3;
}

void CCalculatorDlg::OnButtondiv()   //除號運算符
{
	// TODO: Add your control notification handler code here
	Result();  //記錄

	m_bit =4;
}

void CCalculatorDlg::OnButtonequ()   //等號運算符
{
	// TODO: Add your control notification handler code here
	Result();  //求值
	m_bit = 1;
	m_end = 0;  //清零

}

void CCalculatorDlg::OnC() 
{
	// TODO: Add your control notification handler code here
	m_display = 0;
	m_dot = 0;
	m_bit = 0;
	m_end = m_base = 0;
	UpdateData(FALSE);
}

void CCalculatorDlg::OnCe() 
{
	// TODO: Add your control notification handler code here
	m_display = 0;
	m_dot = 0;
	m_end = 0;
	UpdateData(FALSE);
}

void CCalculatorDlg::OnButtonexp() 
{
	// TODO: Add your control notification handler code here
	m_end=exp(m_end);
    m_display = m_end;
    UpdateData(FALSE);
}

void CCalculatorDlg::OnButtonsqrt() 
{
	// TODO: Add your control notification handler code here
	m_end=sqrt(m_end);
    m_display = m_end;
    UpdateData(FALSE);
}

void CCalculatorDlg::OnButtonSIGN() 
{
	// TODO: Add your control notification handler code here
	m_end *= -1;
    m_display = m_end;
    UpdateData(FALSE);  
}

void CCalculatorDlg::OnBUTTONRec() 
{
	// TODO: Add your control notification handler code here
	m_end = 1/m_end;
    m_display = m_end;
    UpdateData(FALSE);
}

void CCalculatorDlg::OnButtonper() 
{
	// TODO: Add your control notification handler code here
	m_end = m_end/100;
    m_display = m_end;
    UpdateData(FALSE);
}

void CCalculatorDlg::OnFileExit() 
{
	// TODO: Add your command handler code here
	exit(0);
}

void CCalculatorDlg::OnHelpAbout() 
{
	// TODO: Add your command handler code here
	CAboutDlg dlg;
	dlg.DoModal();
}

void CCalculatorDlg::OnBianhuan() 
{
	// TODO: Add your control notification handler code here
	CString str;
	if(GetDlgItemText(IDC_BIANHUAN,str),str=="收縮")
	{
		SetDlgItemText(IDC_BIANHUAN,"擴展");
	}
	else
	{
        SetDlgItemText(IDC_BIANHUAN,"收縮");
	}

	static CRect rectLarge;
    static CRect rectSmall;

	if(rectLarge.IsRectNull())
	{
		CRect rectSeparator;
		GetWindowRect(&rectLarge);
		GetDlgItem(IDC_SEPARATOR)->GetWindowRect(&rectSeparator);

		rectSmall.left=rectLarge.left;
		rectSmall.top=rectLarge.top;
		rectSmall.bottom=rectLarge.bottom;
        rectSmall.right=rectSeparator.right;
	}
    if(str=="收縮")
	{
		SetWindowPos(NULL,0,0,rectSmall.Width(),rectSmall.Height(),SWP_NOMOVE | SWP_NOZORDER);
	}
	else
	{
        SetWindowPos(NULL,0,0,rectLarge.Width(),rectLarge.Height(),SWP_NOMOVE | SWP_NOZORDER);
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲精品一区二区三区 | 日韩电影免费在线| 在线观看亚洲精品视频| 亚洲最大成人网4388xx| 欧美伊人久久久久久久久影院 | 日韩欧美在线一区二区三区| 免费成人av在线| xnxx国产精品| 成人av资源在线观看| 亚洲日本免费电影| 欧美日高清视频| 精品午夜一区二区三区在线观看| 亚洲精品在线一区二区| 成人免费va视频| 一级做a爱片久久| 欧美一区二区二区| 不卡的电影网站| 亚洲电影激情视频网站| 精品久久久久久久久久久久久久久| 国产一区二区不卡| 亚洲精品第1页| 日韩欧美一级片| 99久久婷婷国产| 日韩精品每日更新| 久久精品欧美日韩精品| 97se狠狠狠综合亚洲狠狠| 午夜精品久久久久| 欧美国产一区二区| 欧美日本乱大交xxxxx| 国产在线观看一区二区| 亚洲精品国产品国语在线app| 日韩一区二区三区av| zzijzzij亚洲日本少妇熟睡| 天天爽夜夜爽夜夜爽精品视频| 精品成人在线观看| 在线观看免费视频综合| 国产精品综合二区| 亚洲成av人片一区二区梦乃 | 国产精品视频yy9299一区| 欧洲一区二区三区在线| 国产麻豆视频一区二区| 亚洲一区二区三区四区五区黄 | 亚洲欧美国产高清| 欧美精品一区二区三区很污很色的 | 欧美日韩高清一区二区三区| 丁香桃色午夜亚洲一区二区三区| 午夜欧美视频在线观看| 国产精品蜜臀在线观看| 精品91自产拍在线观看一区| 欧美日韩国产另类不卡| 99久久综合国产精品| 国内精品不卡在线| 日本aⅴ精品一区二区三区| 亚洲精品免费一二三区| 国产欧美日韩久久| 26uuu亚洲综合色欧美| 制服丝袜国产精品| 欧美日韩一区二区三区高清| 99久久99久久精品国产片果冻| 国产一区二区三区四区五区入口| 偷拍亚洲欧洲综合| 亚洲一区二区欧美日韩| 亚洲精选视频免费看| 国产精品色一区二区三区| 2023国产精品| 欧美成人a视频| 91精品国产综合久久精品app| 欧美在线一二三| 色视频欧美一区二区三区| 成人自拍视频在线观看| 激情文学综合网| 韩国精品主播一区二区在线观看| 日韩精品五月天| 天天综合天天综合色| 亚洲国产另类av| 性欧美疯狂xxxxbbbb| 亚洲成人免费观看| 亚洲一区二区三区美女| 亚洲国产美女搞黄色| 日韩精品一二三区| 免费观看日韩电影| 婷婷中文字幕综合| 蜜桃久久久久久久| 美腿丝袜亚洲色图| 狠狠色丁香婷综合久久| 国产精品1024| 国产精品一区久久久久| 国产精品资源站在线| 国产麻豆精品久久一二三| 久久99久久久久| 国产69精品久久777的优势| 成人激情电影免费在线观看| 成人91在线观看| 在线视频你懂得一区二区三区| 欧美视频在线不卡| 日韩亚洲欧美一区二区三区| 欧美mv日韩mv| 国产精品家庭影院| 一区二区三区免费看视频| 亚洲午夜久久久久| 日本亚洲免费观看| 国产精品1区二区.| 色婷婷综合久久久久中文 | av一区二区三区黑人| 99在线视频精品| 欧美视频一二三区| 日韩午夜电影av| 国产欧美一区二区三区网站| 久久噜噜亚洲综合| 欧美一级在线视频| 国产亲近乱来精品视频| 一区二区在线免费观看| 免费观看在线综合色| 国产98色在线|日韩| 日本久久电影网| 在线不卡中文字幕播放| 欧美成人乱码一区二区三区| 欧美—级在线免费片| 亚洲国产日产av| 国产丶欧美丶日本不卡视频| 色噜噜偷拍精品综合在线| 69堂精品视频| 久久久久久久精| 艳妇臀荡乳欲伦亚洲一区| 国产乱对白刺激视频不卡| 在线观看视频一区二区欧美日韩| 欧美日韩色综合| 国产精品免费aⅴ片在线观看| 日韩和欧美一区二区| av资源网一区| 精品日韩99亚洲| 亚洲主播在线观看| 不卡的电影网站| 久久精品视频一区二区三区| 亚洲国产cao| 色哟哟欧美精品| 国产精品欧美一区二区三区| 蜜桃精品视频在线| 欧美专区亚洲专区| 国产精品美女久久久久aⅴ| 美腿丝袜亚洲综合| 欧美日韩国产首页| 亚洲一区二区三区四区在线免费观看 | 国产成人自拍网| 日韩一级片在线观看| 一区二区三区av电影| 懂色av一区二区夜夜嗨| 久久新电视剧免费观看| 日日夜夜免费精品视频| 在线国产亚洲欧美| 国产精品乱人伦一区二区| 国产精品一区二区在线播放| 日韩午夜精品视频| 日本不卡1234视频| 91麻豆精品国产91久久久资源速度 | 综合av第一页| 国产成a人无v码亚洲福利| 欧美成人一区二区三区在线观看| 亚洲成av人片一区二区| 欧美性猛片aaaaaaa做受| 亚洲欧美欧美一区二区三区| www.亚洲人| 最近日韩中文字幕| 99久精品国产| 亚洲欧美另类图片小说| 91论坛在线播放| 亚洲人妖av一区二区| 97久久超碰精品国产| 国产精品国产三级国产普通话三级| 国产精品一卡二卡| 国产日韩欧美精品一区| 国产 欧美在线| 国产精品国产三级国产普通话蜜臀 | 一区二区三区欧美亚洲| 91一区二区三区在线播放| 亚洲四区在线观看| 一本色道久久综合亚洲精品按摩 | 久久九九久精品国产免费直播| 精品中文字幕一区二区小辣椒| 欧美xxxx老人做受| 国产精品中文字幕欧美| 国产精品久久久久aaaa| 91色在线porny| 一区二区日韩av| 91精品国产综合久久久久久| 日本中文字幕一区| 26uuuu精品一区二区| 9i在线看片成人免费| 亚洲国产欧美日韩另类综合 | 欧美日韩亚洲综合一区| 日韩黄色在线观看| 久久综合色鬼综合色| 成人avav在线| 亚洲一区在线观看视频| 欧美一区二区日韩| 丰满亚洲少妇av| 亚洲最快最全在线视频| 久久综合色天天久久综合图片| 99免费精品在线观看| 日本sm残虐另类|