www.pudn.com > ±ÏÒµÁôÄî²á.rar > BrowseView.cpp
// BrowseView.cpp : implementation of the CBrowseView class
//
#include "stdafx.h"
#include "Browse.h"
#include "BrowseDoc.h"
#include "BrowseView.h"
#include "MySheet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CBrowseView
IMPLEMENT_DYNCREATE(CBrowseView, CFormView)
BEGIN_MESSAGE_MAP(CBrowseView, CFormView)
//{{AFX_MSG_MAP(CBrowseView)
ON_WM_ERASEBKGND()
ON_BN_CLICKED(IDC_TESTBTN, OnTestBtn)
ON_BN_CLICKED(IDC_CLOSSE, OnClosse)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBrowseView construction/destruction
CBrowseView::CBrowseView()
: CFormView(CBrowseView::IDD)
{
//{{AFX_DATA_INIT(CBrowseView)
//}}AFX_DATA_INIT
//ͼ»Ë¢
// TODO: add construction code here
}
CBrowseView::~CBrowseView()
{
}
void CBrowseView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CBrowseView)
//}}AFX_DATA_MAP
}
BOOL CBrowseView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CFormView::PreCreateWindow(cs);
}
void CBrowseView::OnInitialUpdate()
{
m_exitBtn.SubclassDlgItem(IDC_CLOSSE,this);
m_exitBtn.DrawTransparent(TRUE);
m_nOpenBtn.SubclassDlgItem(ID_MFILE_OPEN,this);
m_nOpenBtn.DrawTransparent(TRUE);
m_overViewBtn.SubclassDlgItem(IDC_TESTBTN,this);
m_overViewBtn.DrawTransparent(TRUE);
DEVMODE lpDevMode;
long m_p,m_x,m_y;
BOOL bResult=EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&lpDevMode);
if(bResult)
{
m_p=lpDevMode.dmBitsPerPel;
m_x=lpDevMode.dmPelsWidth;
m_y=lpDevMode.dmPelsHeight;
}
if(m_x!=1024)
{
DEVMODE lpDevMode;
lpDevMode.dmBitsPerPel=32;
lpDevMode.dmPelsWidth=1024;
lpDevMode.dmPelsHeight=768;
lpDevMode.dmSize=sizeof(lpDevMode);
lpDevMode.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT|DM_BITSPERPEL;
ChangeDisplaySettings(&lpDevMode,0);
}
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
UpdateData(FALSE);
}
/////////////////////////////////////////////////////////////////////////////
// CBrowseView printing
BOOL CBrowseView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CBrowseView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CBrowseView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
void CBrowseView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
// TODO: add customized printing code here
}
/////////////////////////////////////////////////////////////////////////////
// CBrowseView diagnostics
#ifdef _DEBUG
void CBrowseView::AssertValid() const
{
CFormView::AssertValid();
}
void CBrowseView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
CBrowseDoc* CBrowseView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBrowseDoc)));
return (CBrowseDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBrowseView message handlers
void CBrowseView::OnTestBtn()
{
// TODO: Add your control notification handler code here
CBrowseDoc *pDoc=GetDocument();
CMySheet m_mySheet;
m_mySheet.m_Classe=&(pDoc->m_Classe);
m_ClassmatePage.m_Classe=&(pDoc->m_Classe);
m_MySchoolPage.m_Classe=&(pDoc->m_Classe);
m_TeacherPage.m_Classe=&(pDoc->m_Classe);
m_mySheet.m_MySheet.AddPage(&m_ClassmatePage);
m_mySheet.m_MySheet.AddPage(&m_MySchoolPage);
m_mySheet.m_MySheet.AddPage(&m_TeacherPage);
m_mySheet.DoModal();
}
void CBrowseView::OnClosse()
{
PostQuitMessage(0);
}
BOOL CBrowseView::OnEraseBkgnd(CDC* pDC)
{
CDC memDC;
CBitmap MPlayer;
if(!MPlayer.LoadBitmap(IDB_MAIN))
return FALSE;
memDC.CreateCompatibleDC(pDC);
CBitmap *pOldBmp=memDC.SelectObject(&MPlayer);
pDC->BitBlt(0,0,600,450,&memDC,0,0,SRCCOPY);
memDC.SelectObject(pOldBmp);
return TRUE;
}