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

📄 5huanview.cpp

📁 绘制奥运五环
💻 CPP
字号:
// 5huanView.cpp : implementation of the CMy5huanView class
//

#include "stdafx.h"
#include "5huan.h"

#include "5huanDoc.h"
#include "5huanView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView

IMPLEMENT_DYNCREATE(CMy5huanView, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView construction/destruction

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

}

CMy5huanView::~CMy5huanView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView drawing

void CMy5huanView::OnDraw(CDC* pDC)
{
	CMy5huanDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
 int yLeft[3]={300,390,480};
	int yRight[3]={380,470,560};
	for (int i=0;i<3;i++)
	{
	  CPen *pPenOld,PenNew;
      COLORREF rgbPenClr[]={RGB(0,0,255),RGB(0,0,0),RGB(255,0,0)};                   
      CPen *pPenNew=new CPen(PS_SOLID,2,rgbPenClr[i]);
      pPenOld=pDC->SelectObject(pPenNew);
	  pDC->Ellipse(yLeft[i],200,yRight[i],280);
      pDC->SelectObject(pPenOld);
      PenNew.DeleteObject();
	}
    int yLeft1[2]={350,440};
	int yRight1[2]={430,520};
for (int j=0;j<2;j++)
{	
	 CPen *pPenOld,PenNew;
	 CBrush *pBrhOld,BrushNew;
     COLORREF rgbPenClr[]={RGB(255,255,0),RGB(0,255,0)};                   
     CPen *pPenNew=new CPen(PS_SOLID,2,rgbPenClr[j]);
     CBrush *pBrhNew=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
     pPenOld=pDC->SelectObject(pPenNew);
	 pBrhOld=pDC->SelectObject(pBrhNew);
	 pDC->Ellipse(yLeft1[j],250,yRight1[j],330);
     pDC->SelectObject(pPenOld);
     pDC->SelectObject(pBrhOld);
     PenNew.DeleteObject();
     BrushNew.DeleteObject();
}


}

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMy5huanView message handlers

⌨️ 快捷键说明

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