📄 byangtiaoview.cpp
字号:
// ByangtiaoView.cpp : implementation of the CByangtiaoView class
//
#include "stdafx.h"
#include "Byangtiao.h"
#include "ByangtiaoDoc.h"
#include "ByangtiaoView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CByangtiaoView
IMPLEMENT_DYNCREATE(CByangtiaoView, CView)
BEGIN_MESSAGE_MAP(CByangtiaoView, CView)
//{{AFX_MSG_MAP(CByangtiaoView)
// 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
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CByangtiaoView construction/destruction
CByangtiaoView::CByangtiaoView()
{
// TODO: add construction code here
}
CByangtiaoView::~CByangtiaoView()
{
}
BOOL CByangtiaoView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CByangtiaoView drawing
void CByangtiaoView::OnDraw(CDC* pDC)
{
CByangtiaoDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
pDC->SetMapMode(MM_ISOTROPIC);
pDC->SetViewportOrg(50,400);
pDC->MoveTo(0,0);
pDC->LineTo(2000,0);
pDC->MoveTo(0,0);
pDC->LineTo(0,1000);
POINT p1,p2,p3,p4,p5,p6;
p1.x=200,p1.y=200;
p2.x=100,p2.y=400;
p3.x=300,p3.y=600;
p4.x=500,p4.y=400;
p5.x=700,p5.y=600;
p6.x=900,p6.y=100;
pDC->MoveTo(p1);
pDC->LineTo(p2);
pDC->LineTo(p3);
pDC->LineTo(p4);
pDC->LineTo(p5);
pDC->LineTo(p6);
int x[]={50,p1.x,p2.x,p3.x,p4.x,p5.x,p6.x,120};
int y[]={600,p1.y,p2.y,p3.y,p4.y,p5.y,p6.y,120};
POINT p;
float t,t1,t2,a,b,c,tx,ty;
*x=*(x+1);*y=*(y+1);
*(x+6+1)=*(x+6);*(y+6+1)=*(y+6);
t=1.0/10;
pDC->MoveTo((*x+(*(x+1)))/2.0,(*y+(*(y+1)))/2.0);
for(int i=0;i<6;i++)
{
for(int j=1;j<10;j++)
{
t1=j*t;
t2=t1*t1;
a=(t2-2*t1+1)/2.0;
b=t1-t2+1/2.0;
c=t2/2.0;
p.x=a*(*(x+i))+b*(*(x+i+1))+c*(*(x+i+2));
p.y=a*(*(y+i))+b*(*(y+i+1))+c*(*(y+i+2));
pDC->LineTo(p);
}
}
}
/////////////////////////////////////////////////////////////////////////////
// CByangtiaoView diagnostics
#ifdef _DEBUG
void CByangtiaoView::AssertValid() const
{
CView::AssertValid();
}
void CByangtiaoView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CByangtiaoDoc* CByangtiaoView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CByangtiaoDoc)));
return (CByangtiaoDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CByangtiaoView message handlers
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -