【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-Ex06_2View.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// Ex06_2View.cpp : implementation of the CEx06_2View class
//
#include "stdafx.h"
#include "Ex06_2.h"
#include "Ex06_2Doc.h"
#include "Ex06_2View.h"
#include "ModelDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View
IMPLEMENT_DYNCREATE(CEx06_2View, CView)
BEGIN_MESSAGE_MAP(CEx06_2View, CView)
//{{AFX_MSG_MAP(CEx06_2View)
ON_COMMAND(ID_SHOWDLG_MODELDLG, OnShowdlgModeldlg)
ON_COMMAND(ID_SHOWDLG_MODELESSDLG, OnShowdlgModelessdlg)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View construction/destruction
CEx06_2View::CEx06_2View()
{
// TODO: add construction code here
pdlg=NULL;
}
CEx06_2View::~CEx06_2View()
{
delete pdlg; //删除pdlg,释放内存
}
BOOL CEx06_2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View drawing
void CEx06_2View::OnDraw(CDC* pDC)
{
CEx06_2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View printing
BOOL CEx06_2View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx06_2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx06_2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View diagnostics
#ifdef _DEBUG
void CEx06_2View::AssertValid() const
{
CView::AssertValid();
}
void CEx06_2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEx06_2Doc* CEx06_2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx06_2Doc)));
return (CEx06_2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx06_2View message handlers
void CEx06_2View::OnShowdlgModeldlg()
{
// TODO: Add your command handler code here
CModelDlg modeldlg; //定义CModelDlg对话框类对象
modeldlg.DoModal(); //显示模式对话框
}
void CEx06_2View::OnShowdlgModelessdlg()
{
// TODO: Add your command handler code here
pdlg=new CModelessDlg(this);
pdlg->Create(IDD_MODELESSDLG);
pdlg->ShowWindow(SW_RESTORE);
}