?? paint2view.cpp
字號(hào):
// paint2View.cpp : implementation of the CPaint2View class
//
#include "stdafx.h"
#include "paint2.h"
#include "paint2Doc.h"
#include "paint2View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CPaint2View
IMPLEMENT_DYNCREATE(CPaint2View, CView)
BEGIN_MESSAGE_MAP(CPaint2View, CView)
//{{AFX_MSG_MAP(CPaint2View)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CPaint2View construction/destruction
CPaint2View::CPaint2View()
{
// TODO: add construction code here
}
CPaint2View::~CPaint2View()
{
}
BOOL CPaint2View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CPaint2View drawing
void CPaint2View::OnDraw(CDC* pDC)
{
CPaint2Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
int x0=5,y0=5,x1=100,y1=100;
int dx,dy,e,i,x,y;
dx=x1-x0;
dy=y1-y0;
e=2*dy-dx; x=x0;
y=y0;
for(i=0;i<=dx;i++)
{pDC->SetPixel(x,y,RGB(255,0,0)); x++;
e=e+2*dy;
if(e>=0)
{y++;
e=e-2*dx;
}
}
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CPaint2View printing
BOOL CPaint2View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CPaint2View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CPaint2View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CPaint2View diagnostics
#ifdef _DEBUG
void CPaint2View::AssertValid() const
{
CView::AssertValid();
}
void CPaint2View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CPaint2Doc* CPaint2View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPaint2Doc)));
return (CPaint2Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CPaint2View message handlers
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -