📄 pollutionview.cpp
字号:
// PollutionView.cpp : implementation of the CPollutionView class
//
#include "stdafx.h"
#include "Pollution.h"
#include "PollutionDoc.h"
#include "PollutionView.h"
#include "air.h"
#include "HyBen.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPollutionView
IMPLEMENT_DYNCREATE(CPollutionView, CView)
BEGIN_MESSAGE_MAP(CPollutionView, CView)
//{{AFX_MSG_MAP(CPollutionView)
ON_COMMAND(DISPLAYMENT, OnDISPLAYMENT)
ON_WM_TIMER()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CPollutionView construction/destruction
CAir air;
CHyBen HyBen;
CPollutionView::CPollutionView()
{
// TODO: add construction code here
}
CPollutionView::~CPollutionView()
{
}
BOOL CPollutionView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPollutionView drawing
void CPollutionView::OnDraw(CDC* pDC)
{
CPollutionDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
//CClientDC pCDC(this);
//air.PrintAir(20,20,20,&pCDC);
}
/////////////////////////////////////////////////////////////////////////////
// CPollutionView printing
BOOL CPollutionView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CPollutionView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CPollutionView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CPollutionView diagnostics
#ifdef _DEBUG
void CPollutionView::AssertValid() const
{
CView::AssertValid();
}
void CPollutionView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CPollutionDoc* CPollutionView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPollutionDoc)));
return (CPollutionDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPollutionView message handlers
void CPollutionView::OnDISPLAYMENT()
{
// TODO: Add your command handler code here
Invalidate();
SetTimer(1,500,NULL);
timer1=0;
}
void CPollutionView::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
timer1++;
air.m_nDisplayment+=10;
CClientDC pCDC(this);
//pCDC.
air.PrintAir(100,20,20,&pCDC);
HyBen.m_fTime+=10;
//HyBen.PrintBen(20,20,HyBen.m_fTime,&pCDC);
CView::OnTimer(nIDEvent);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -