📄 ellipseview.cpp
字号:
// EllipseView.cpp : implementation of the CEllipseView class
//
#include "stdafx.h"
#include "Ellipse.h"
#include "EllipseDoc.h"
#include "EllipseView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEllipseView
IMPLEMENT_DYNCREATE(CEllipseView, CView)
BEGIN_MESSAGE_MAP(CEllipseView, CView)
//{{AFX_MSG_MAP(CEllipseView)
// 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()
/////////////////////////////////////////////////////////////////////////////
// CEllipseView construction/destruction
CEllipseView::CEllipseView()
{
// TODO: add construction code here
}
CEllipseView::~CEllipseView()
{
}
BOOL CEllipseView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CEllipseView drawing
void CEllipseView::OnDraw(CDC* pDC)
{
CEllipseDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int yLeft[5]={0,70,140,210,280};
int yRight[5]={70,140,210,280,350};
for(int i=1;i<=5;i++) // 绘制五个纵向排列整齐的椭圆
pDC->Ellipse(100,yLeft[i],300,yRight[i]); // 参数为椭圆外接矩形的左上角和右下角坐标
}
/////////////////////////////////////////////////////////////////////////////
// CEllipseView printing
BOOL CEllipseView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CEllipseView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CEllipseView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CEllipseView diagnostics
#ifdef _DEBUG
void CEllipseView::AssertValid() const
{
CView::AssertValid();
}
void CEllipseView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CEllipseDoc* CEllipseView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CEllipseDoc)));
return (CEllipseDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CEllipseView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -