📄 exam5_3view.cpp
字号:
// Exam5_3View.cpp : implementation of the CExam5_3View class
//
#include "stdafx.h"
#include "Exam5_3.h"
#include "Exam5_3Doc.h"
#include "Exam5_3View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View
IMPLEMENT_DYNCREATE(CExam5_3View, CView)
BEGIN_MESSAGE_MAP(CExam5_3View, CView)
//{{AFX_MSG_MAP(CExam5_3View)
ON_WM_RBUTTONDOWN()
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()
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View construction/destruction
CExam5_3View::CExam5_3View()
{
// TODO: add construction code here
m_Mode=MM_TEXT;
}
CExam5_3View::~CExam5_3View()
{
}
BOOL CExam5_3View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View drawing
void CExam5_3View::OnDraw(CDC* pDC)
{
CExam5_3Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->SetMapMode (m_Mode);//设置映像模式
pDC->SetWindowExt(150,150);//设置窗口区域
pDC->SetViewportExt (150,100);//设置视图区域
pDC->SetViewportOrg (50,60);//设置视图原点
pDC->SelectStockObject (BLACK_BRUSH);//将黑色画刷选入设备环境
pDC->RoundRect (0,0,150,150,30,30);//绘制圆角矩形
pDC->SelectStockObject (WHITE_BRUSH);//将白色画刷选入设备环境
pDC->Ellipse (0,10,150,140);//绘制椭圆
}
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View printing
BOOL CExam5_3View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CExam5_3View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CExam5_3View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View diagnostics
#ifdef _DEBUG
void CExam5_3View::AssertValid() const
{
CView::AssertValid();
}
void CExam5_3View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExam5_3Doc* CExam5_3View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExam5_3Doc)));
return (CExam5_3Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExam5_3View message handlers
void CExam5_3View::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Mode=MM_ANISOTROPIC;
this->InvalidateRect (NULL,true);
CView::OnRButtonDown(nFlags, point);
}
void CExam5_3View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Mode=MM_ISOTROPIC;
this->InvalidateRect (NULL,true);
CView::OnLButtonDown(nFlags, point);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -