📄 li1_1view.cpp
字号:
// Li1_1View.cpp : implementation of the CLi1_1View class
//
#include "stdafx.h"
#include "Li1_1.h"
#include "Li1_1Doc.h"
#include "Li1_1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View
IMPLEMENT_DYNCREATE(CLi1_1View, CView)
BEGIN_MESSAGE_MAP(CLi1_1View, CView)
//{{AFX_MSG_MAP(CLi1_1View)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View construction/destruction
CLi1_1View::CLi1_1View()
{
// TODO: add construction code here
}
CLi1_1View::~CLi1_1View()
{
}
BOOL CLi1_1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View drawing
void CLi1_1View::OnDraw(CDC* pDC)
{
CLi1_1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int num[5]={2,4,6,8,10};
int sum=0;
for(int i=0;i<5;i++){
sum+=num[i];
}
CString strSum;
strSum.Format("%d",sum);
pDC->TextOut(0,0,"2~10中偶数的和是:"+strSum);
}
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View printing
BOOL CLi1_1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLi1_1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLi1_1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View diagnostics
#ifdef _DEBUG
void CLi1_1View::AssertValid() const
{
CView::AssertValid();
}
void CLi1_1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CLi1_1Doc* CLi1_1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLi1_1Doc)));
return (CLi1_1Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLi1_1View message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -