artview.cpp

来自「本光盘包含的是《实用Visual C++ 6.0教程》一书中所有程序的代码」· C++ 代码 · 共 79 行

CPP
79
字号
// ArtView.cpp : implementation file
//

#include "stdafx.h"
#include "VPick.h"
#include "ArtView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CArtView

IMPLEMENT_DYNCREATE(CArtView, CView)

CArtView::CArtView()
{
}

CArtView::~CArtView()
{
}


BEGIN_MESSAGE_MAP(CArtView, CView)
	//{{AFX_MSG_MAP(CArtView)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CArtView drawing

void CArtView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here

	//**Save the current brush
	CBrush *pOldBrush=pDC->GetCurrentBrush();

	//Create a solid blue brush
	CBrush br;
	br.CreateSolidBrush(RGB(0,0,255));

	//**Select the blue brush in to the device context
	pDC->SelectObject(&br);
	pDC->Ellipse(1,1,300,300);
	br.Detach();

	br.CreateHatchBrush(HS_FDIAGONAL,RGB(255,255,0));
	pDC->SelectObject(&br);
	pDC->Ellipse(50,50,200,200);

	//*Restore the current brush
	pDC->SelectObject(pOldBrush);
}

/////////////////////////////////////////////////////////////////////////////
// CArtView diagnostics

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

void CArtView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CArtView message handlers

⌨️ 快捷键说明

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