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

📄 xllview.cpp

📁 法国和 法国规范化法国和 法国和服分和法国号法国号法国号法国号法国号法国号法国和法国号
💻 CPP
字号:
// xllView.cpp : implementation of the CXllView class
//

#include "stdafx.h"
#include "xll.h"

#include "xllDoc.h"
#include "xllView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CXllView

IMPLEMENT_DYNCREATE(CXllView, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CXllView construction/destruction

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

}

CXllView::~CXllView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CXllView drawing

void CXllView::OnDraw(CDC* pDC)
{
	CXllDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	int OX=300,OY=200;
	 int x1=50,y1=-100,x2=200,y2=-50,x3=70,y3=-30;
	 CPen p1(PS_SOLID,4,RGB(0,0,0));
	 CPen *pOldPen = NULL;
	 pDC->SelectObject(&p1);
	 pDC->MoveTo(0,200);
     pDC->LineTo(1200,200);
	 pDC->MoveTo(300,0);
     pDC->LineTo(300,1000);
	 POINT pt[3]={{OX+x1,OY+y1},{OX+x2,OY+y2},{OX+x3,OY+y3}};
	 CPen p2(PS_SOLID,3,RGB(100,250,110));
	 pDC->SelectObject(&p2);
	 pDC->Polygon(pt,3);
	 
	 //关于X轴对称
	int y11=xduicheng(y1);
    int	 y22=xduicheng(y2);
    int	 y33=xduicheng(y3);
	

	 POINT pt1[3]={{OX+x1,OY+y11},{OX+x2,OY+y22},{OX+x3,OY+y33}};
	 pDC->Polygon(pt1,3);
	 
	 //关于圆点对称
	 int a[3][2]={{x1,y1},{x2,y2},{x3,y3}};
	 yuandian( a);
	 POINT pt2[3]={{OX+a[0][0],OY+a[0][1]},{OX+a[1][0],OY+a[1][1]},{OX+a[2][0],OY+a[2][1]}};
     pDC->Polygon(pt2,3);
	 
	 //关于45度直线对称

     int b[3][2]={{x1,y1},{x2,y2},{x3,y3}};
	   xiedc(b);
	   pDC->MoveTo(OX+b[0][0],OY+b[0][1]);
	   pDC->LineTo(OX+b[1][0],OY+b[1][1]);
	   pDC->LineTo(OX+b[2][0],OY+b[2][1]);
	   pDC->LineTo(OX+b[0][0],OY+b[0][1]);
	 
	  
	  //根据比例画图
	int c[3][2]={{x1,y1},{x2,y2},{x3,y3}};
	int d[2][2]={{2,0},{0,1}};
	bili(c,d);
	 pDC->MoveTo(OX+c[0][0],OY+c[0][1]);
	 pDC->LineTo(OX+c[1][0],OY+c[1][1]);
	 pDC->LineTo(OX+c[2][0],OY+c[2][1]);
	 pDC->LineTo(OX+c[0][0],OY+c[0][1]);
//	POINT pt4[3]={{OX+c[0][0],OY+c[0][1]},{OX+c[1][0],OY+c[1][1]},{OX+c[2][0],OY+c[2][1]}};
	  //pDC->Polygon(pt4,3);
	  


	 
}

/////////////////////////////////////////////////////////////////////////////
// CXllView printing

BOOL CXllView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CXllView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CXllView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CXllView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CXllView message handlers

int CXllView::xduicheng(int y)
{
	int m;
    m=-y;
	return m;

}


void CXllView::yuandian(int a[][2])
{ for (int i=0;i<3;i++)

{ 
	for(int j=0;j<2;j++)
		a[i][j]=-a[i][j];}


}

void CXllView::xiedc(int a[][2])
{   int t;
	for (int i=0;i<3;i++)
	{ t= a[i][0];
	  a[i][0]=-a[i][1];
	  a[i][1]=-t;}


	



}


void CXllView::bili(int c[][2], int d[][2])
{  for(int j=0;j<2;j++)
{ int	p=d[j][j];
 	 for(int i=0;i<3;i++)
		 c[i][j]=p*c[i][j];}
	

}

⌨️ 快捷键说明

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