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

📄 testrop2view.cpp

📁 Visual c++.程序设计培训教程
💻 CPP
字号:
// TestROP2View.cpp : implementation of the CTestROP2View class
//

#include "stdafx.h"
#include "TestROP2.h"

#include "TestROP2Doc.h"
#include "TestROP2View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View

IMPLEMENT_DYNCREATE(CTestROP2View, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View construction/destruction

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

}

CTestROP2View::~CTestROP2View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View drawing

void CTestROP2View::OnDraw(CDC* pDC)
{
	CTestROP2Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	//构造CDC对象
	CClientDC dc(this);
	//设置绘图混和模式
	dc.SetROP2(R2_XORPEN);

	//创建一个红色的阴影模式画刷
	CBrush  newbrush(HS_CROSS, RGB(255,0,0));
	CBrush * pOld = dc.SelectObject(&newbrush);
	//画一个400×200的矩形
	dc.Rectangle(100,100,500,300);

	dc.SelectObject(pOld);
}

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CTestROP2View message handlers

⌨️ 快捷键说明

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