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

📄 juxingview.cpp

📁 本压缩软件为《Visual C++6.0基础教程》(黑魔方系列)一书的源代码
💻 CPP
字号:
// JuxingView.cpp : implementation of the CJuxingView class
//

#include "stdafx.h"
#include "Juxing.h"

#include "JuxingDoc.h"
#include "JuxingView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CJuxingView

IMPLEMENT_DYNCREATE(CJuxingView, CView)

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

/////////////////////////////////////////////////////////////////////////////
// CJuxingView construction/destruction

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

}

CJuxingView::~CJuxingView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CJuxingView drawing

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

/////////////////////////////////////////////////////////////////////////////
// CJuxingView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CJuxingView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CJuxingView message handlers

void CJuxingView::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	xS=point.x;
	yS=point.y;	
	CView::OnLButtonDown(nFlags, point);
}
void CJuxingView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	xS=-1;
	CView::OnLButtonUp(nFlags, point);
}

void CJuxingView::OnMouseMove(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CGdiObject* pBackup;
	CClientDC dc(this);
	if(xS>=0)
	{
		dc.Rectangle (xS,yS,point.x,point.y);
		pBackup=dc.SelectStockObject (NULL_BRUSH);
	}
	CView::OnMouseMove(nFlags, point);
}

⌨️ 快捷键说明

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