www.gusucode.com > 《C++高级语言程序设计》PPT及全书例子源代码-源码程序 > 《C++高级语言程序设计》PPT及全书例子源代码-源码程序/code/C++例题程序/第7章/s7_3/s7_3View.cpp
//Download by http://www.NewXing.com // s7_3View.cpp : implementation of the CS7_3View class // #include "stdafx.h" #include "s7_3.h" #include "s7_3Doc.h" #include "s7_3View.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CS7_3View IMPLEMENT_DYNCREATE(CS7_3View, CView) BEGIN_MESSAGE_MAP(CS7_3View, CView) //{{AFX_MSG_MAP(CS7_3View) ON_WM_CREATE() ON_WM_DESTROY() //}}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() ///////////////////////////////////////////////////////////////////////////// // CS7_3View construction/destruction CS7_3View::CS7_3View() { // TODO: add construction code here } CS7_3View::~CS7_3View() { } BOOL CS7_3View::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CS7_3View drawing void CS7_3View::OnDraw(CDC* pDC) { CS7_3Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here } ///////////////////////////////////////////////////////////////////////////// // CS7_3View printing BOOL CS7_3View::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CS7_3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CS7_3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CS7_3View diagnostics #ifdef _DEBUG void CS7_3View::AssertValid() const { CView::AssertValid(); } void CS7_3View::Dump(CDumpContext& dc) const { CView::Dump(dc); } CS7_3Doc* CS7_3View::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CS7_3Doc))); return (CS7_3Doc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CS7_3View message handlers int CS7_3View::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CView::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here AfxMessageBox("窗口正在建立!"); //新代码 return 0; } void CS7_3View::OnDestroy() { CView::OnDestroy(); // TODO: Add your message handler code here AfxMessageBox("窗口已关闭!"); //新代码 }