📄 ex3_5view.cpp
字号:
// Ex3_5View.cpp : implementation of the CEx3_5View class
//
#include "stdafx.h"
#include "Ex3_5.h"
#include "Ex3_5Doc.h"
#include "Ex3_5View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View
IMPLEMENT_DYNCREATE(CEx3_5View, CView)
BEGIN_MESSAGE_MAP(CEx3_5View, CView)
//{{AFX_MSG_MAP(CEx3_5View)
ON_WM_LBUTTONDOWN()
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View construction/destruction
CEx3_5View::CEx3_5View()
{
// TODO: add construction code here
}
CEx3_5View::~CEx3_5View()
{
}
BOOL CEx3_5View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View drawing
void CEx3_5View::OnDraw(CDC* pDC)
{
CEx3_5Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CPoint ort;
CString str;
for(int i=0;i<=pDoc->m_iPoint;i++)
{
ort=pDoc->m_PointArray[i];
str.Format("[%d,%d]",ort.x,ort.y);
pDC->TextOut (ort.x,ort.y,str);
}
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View printing
BOOL CEx3_5View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEx3_5View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEx3_5View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View diagnostics
#ifdef _DEBUG
void CEx3_5View::AssertValid() const
{
CView::AssertValid();
}
void CEx3_5View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEx3_5Doc* CEx3_5View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEx3_5Doc)));
return (CEx3_5Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEx3_5View message handlers
void CEx3_5View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CEx3_5Doc *pDoc=GetDocument();
pDoc->m_iPoint ++;
pDoc->m_PointArray [pDoc->m_iPoint ]=point;
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -