【VC开源代码栏目提醒】:本文主要为网学会员提供mainView.cpp,希望对需要mainView.cpp网友有所帮助,学习一下!
// mainView.cpp : implementation of the CMainView class
//
#include "stdafx.h"
#include "main.h"
#include "mainDoc.h"
#include "mainView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainView
IMPLEMENT_DYNCREATE(CMainView, CView)
BEGIN_MESSAGE_MAP(CMainView, CView)
//{{AFX_MSG_MAP(CMainView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CMainView construction/destruction
CMainView::CMainView()
{
// TODO: add construction code here
}
CMainView::~CMainView()
{
}
BOOL CMainView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainView drawing
void CMainView::OnDraw(CDC* pDC)
{
CMainDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CString ShowStr[]={"Lib.dll",
"Class CCalculate,baseClass is CView",
"int OutPut(int a,int b) A Function in Class Calculate to calculate a*b",
"Class CChildCal,baseClass is CCalculate",
"int Devide(int a,int b) A Function in Class Calculate to calculate a/b",
""};
switch(pDoc->m_ItemNum )
{
case 0:
pDC->TextOut(10,15,ShowStr[0],ShowStr[0].GetLength());
break;
case 1:
pDC->TextOut(10,15,ShowStr[1],ShowStr[1].GetLength());
break;
case 11:
pDC->TextOut (10,15,ShowStr[2],ShowStr[2].GetLength ());
break;
case 2:
pDC->TextOut (10,15,ShowStr[3],ShowStr[3].GetLength ());
break;
case 21:
pDC->TextOut (10,15,ShowStr[4],ShowStr[4].GetLength ());
break;
default:
break;
}
}
void CMainView::OnInitialUpdate()
{
CView::OnInitialUpdate();
}
/////////////////////////////////////////////////////////////////////////////
// CMainView printing
BOOL CMainView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CMainView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CMainView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CMainView diagnostics
#ifdef _DEBUG
void CMainView::AssertValid() const
{
CView::AssertValid();
}
void CMainView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMainDoc* CMainView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMainDoc)));
return (CMainDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainView message handlers
void CMainView::OnStyleChanged(int nStyleType, LPSTYLESTRUCT lpStyleStruct)
{
//TODO: add code to react to the user changing the view style of your window
}
上一篇:
MainSocket.cpp
下一篇:
哈弗F7 VS名爵HS,谁更懂得年轻人的心?