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

📄 exam5_13view.cpp

📁 只是一些书籍上的小代码!!!希望站长允许上传
💻 CPP
字号:
// Exam5_13View.cpp : implementation of the CExam5_13View class
//

#include "stdafx.h"
#include "Exam5_13.h"

#include "Exam5_13Doc.h"
#include "Exam5_13View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View

IMPLEMENT_DYNCREATE(CExam5_13View, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View construction/destruction

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

}

CExam5_13View::~CExam5_13View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View drawing

void CExam5_13View::OnDraw(CDC* pDC)
{
	CExam5_13Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	//设置映像模式
	pDC->SetMapMode(MM_ANISOTROPIC);
	CPen NewPen,OldPen;
	//创建蓝色实线画笔
	NewPen.CreatePen(PS_SOLID,5,RGB(0,0,255));
	//将画笔选入设备上下文
	pDC->SelectObject(&NewPen);
	CBrush NewBrush1,NewBrush2;
	//创建深蓝色实心画刷
	NewBrush1.CreateSolidBrush(RGB(0,0,128));
	//将画刷选入设备上下文
	pDC->SelectObject(&NewBrush1);
	//绘制圆角矩形
	pDC->RoundRect(200,100,330,200,15,15);
	//将库存对象浅灰画刷选入设备上下文
	pDC->SelectStockObject(LTGRAY_BRUSH);
	//绘制饼状图
	pDC->Pie(350,50,420,150,360,50,400,50);
	//创建阴影画刷
    NewBrush2.CreateHatchBrush(HS_DIAGCROSS,RGB(125,125,125));
    pDC->SelectObject(NewBrush2);
    //绘制椭圆
    pDC->Ellipse(50,50,150,150);
}

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CExam5_13View message handlers

⌨️ 快捷键说明

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