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

📄 rerewview.cpp

📁 随机划椭圆,它可以完成随机画椭圆功能,可以自定义颜色等
💻 CPP
字号:
// rerewView.cpp : implementation of the CRerewView class
//

#include "stdafx.h"
#include "rerew.h"

#include "rerewDoc.h"
#include "rerewView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CRerewView

IMPLEMENT_DYNCREATE(CRerewView, CView)

BEGIN_MESSAGE_MAP(CRerewView, CView)
	//{{AFX_MSG_MAP(CRerewView)
	ON_WM_LBUTTONDOWN()
	ON_WM_MOUSEMOVE()
	ON_WM_LBUTTONUP()
	//}}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()

/////////////////////////////////////////////////////////////////////////////
// CRerewView construction/destruction

CRerewView::CRerewView()
{
	// TODO: add construction code here
	br.CreateHatchBrush(HS_BDIAGONAL,RGB(255,0,0));

}

CRerewView::~CRerewView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CRerewView drawing

void CRerewView::OnDraw(CDC* pDC)
{
	CRerewDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CRerewView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CRerewView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CRerewView message handlers

void CRerewView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CView::OnLButtonDown(nFlags, point);
	p0=p1=point;
}

void CRerewView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CView::OnMouseMove(nFlags, point);
	CClientDC dc(this);
	pbr=dc.SelectObject(&br);
	dc.SetROP2(R2_XORPEN);
	dc.Ellipse(p0.x,p0.y,p1.x,p1.y);
	p1=point;
    dc.Ellipse(p0.x,p0.y,p1.x,p1.y);
	dc.SelectObject(pbr);
}

void CRerewView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	
	CView::OnLButtonUp(nFlags, point);
	CClientDC dc(this);
}

⌨️ 快捷键说明

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