📄 dlgsoe.cpp
字号:
// DlgSOE.cpp : implementation file
//
#include "stdafx.h"
#include "CalculatorGUI.h"
#include "DlgSOE.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgSOE dialog
CDlgSOE::CDlgSOE(CWnd* pParent /*=NULL*/)
: CDialog(CDlgSOE::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgSOE)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CDlgSOE::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgSOE)
DDX_Control(pDX, IDC_TAB1, m_tabCtrl);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgSOE, CDialog)
//{{AFX_MSG_MAP(CDlgSOE)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
ON_WM_ERASEBKGND()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgSOE message handlers
BOOL CDlgSOE::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_tabCtrl.InsertItem(0,"Two equations");
m_tabCtrl.InsertItem(1,"Three equations");
index = 0;
p1.Create(IDD_DIALOG_SO2E,this);
p1.ShowWindow(SW_SHOW);
p2.Create(IDD_DIALOG_SO3E,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
}
void CDlgSOE::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;
}
// Tao bitmap background cho dialog
BOOL CDlgSOE::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 CDlgSOE::SetBitmap(UINT nIDResource)
{
if(m_bitmap.LoadBitmap(nIDResource))
return 0;
else
return 1;//error
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -