📄 dlgequation.cpp
字号:
// DlgEquation.cpp : implementation file
//
#include "stdafx.h"
#include "CalculatorGUI.h"
#include "DlgEquation.h"
#include "Lib/PhuongTrinh.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgEquation dialog
CDlgEquation::CDlgEquation(CWnd* pParent /*=NULL*/)
: CDialog(CDlgEquation::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgEquation)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgEquation::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgEquation)
DDX_Control(pDX, IDC_TAB1, m_tabCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgEquation, CDialog)
//{{AFX_MSG_MAP(CDlgEquation)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgEquation message handlers
void CDlgEquation::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
index = m_tabCtrl.GetCurSel();
switch (index)
{
case 0:
p1.ShowWindow(SW_SHOW);
p2.ShowWindow(SW_HIDE);
break;
case 1:
p1.ShowWindow(SW_HIDE);
p2.ShowWindow(SW_SHOW);
break;
}
*pResult = 0;
}
BOOL CDlgEquation::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_tabCtrl.InsertItem(0,"Linear Equation");
m_tabCtrl.InsertItem(1,"Quadratic Equation");
index = 0;
p1.Create(IDD_DIALOG_LINEAREQUA,this);
p1.ShowWindow(SW_SHOW);
p2.Create(IDD_DIALOG_QUADRATICEQUA,this);
p2.ShowWindow(SW_HIDE);
SetBitmap(IDB_BITMAP3);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
// Tao bitmap background cho dialog
BOOL CDlgEquation::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnEraseBkgnd(pDC);
if(!m_bitmap.m_hObject)
return true;
CRect rect;
GetClientRect(&rect);
CDC dc;
dc.CreateCompatibleDC(pDC);
CBitmap* pOldBitmap = dc.SelectObject(&m_bitmap);
int bmw, bmh ;
BITMAP bmap;
m_bitmap.GetBitmap(&bmap);
bmw = bmap.bmWidth;
bmh = bmap.bmHeight;
int xo=0, yo=0;
if(bmw < rect.Width())
xo = (rect.Width() - bmw)/2;
else
xo=0;
if(bmh < rect.Height())
yo = (rect.Height()-bmh)/2;
else
yo=0;
pDC->BitBlt (xo, yo, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY);
dc.SelectObject(pOldBitmap);
return true;
}
int CDlgEquation::SetBitmap(UINT nIDResource)
{
if(m_bitmap.LoadBitmap(nIDResource))
return 0;
else
return 1;//error
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -