⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cantoview.cpp

📁 cantor三分集的递归算法
💻 CPP
字号:
// cantoView.cpp : implementation of the CCantoView class
//

#include "stdafx.h"
#include "canto.h"

#include "cantoDoc.h"
#include "cantoView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCantoView

IMPLEMENT_DYNCREATE(CCantoView, CView)

BEGIN_MESSAGE_MAP(CCantoView, CView)
	//{{AFX_MSG_MAP(CCantoView)
		// 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()

/////////////////////////////////////////////////////////////////////////////
// CCantoView construction/destruction

CCantoView::CCantoView()
{
	// TODO: add construction code here

}

CCantoView::~CCantoView()
{
}

BOOL CCantoView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CCantoView drawing

void CCantoView::OnDraw(CDC* pDC)
{
	CCantoDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	AfxGetMainWnd()->SetWindowText("cantor三分集(分形频道:fractal.cn)2004"); 
	canto(50,100,750,100);
}

/////////////////////////////////////////////////////////////////////////////
// CCantoView diagnostics

#ifdef _DEBUG
void CCantoView::AssertValid() const
{
	CView::AssertValid();
}

void CCantoView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CCantoDoc* CCantoView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCantoDoc)));
	return (CCantoDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CCantoView message handlers

void CCantoView::canto(int ax, int ay, int bx, int by)
{	
	CClientDC pDC(this);
	int c=10;
	if((bx-ax)<c) 
	{
		pDC.MoveTo (ax,ay);
		pDC.LineTo (bx,by);
	}
	else
	{
		int cx,cy,dx,dy;
		pDC.MoveTo (ax,ay);
		pDC.LineTo (bx,by);
		cx = ax + (bx - ax) / 3;
        cy = ay + 50;
        dx = bx - (bx - ax) / 3;
        dy = by + 50;
        ay = ay + 50;
        by = by + 50;

		canto(ax, ay, cx, cy);
        canto(dx, dy, bx, by);
	}
 
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -