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

📄 mycursorview.cpp

📁 这个是我们学校用的VC++教案
💻 CPP
字号:
// MyCursorView.cpp : implementation of the CMyCursorView class
//

#include "stdafx.h"
#include "MyCursor.h"

#include "MyCursorDoc.h"
#include "MyCursorView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMyCursorView

IMPLEMENT_DYNCREATE(CMyCursorView, CView)

BEGIN_MESSAGE_MAP(CMyCursorView, CView)
	//{{AFX_MSG_MAP(CMyCursorView)
	ON_WM_SETCURSOR()
	ON_COMMAND(ID_VIEW_SYSCUR, OnViewSyscur)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMyCursorView construction/destruction

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

}

CMyCursorView::~CMyCursorView()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMyCursorView drawing

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

//	BeginWaitCursor();
/*	SetCapture();
			HCURSOR  hcursor;
//IDC_ CURSOR1为要加载光标的ID
		hcursor=AfxGetApp( )->LoadCursor(IDC_POINTER_COPY);  
		SetCursor(hcursor);
*/
//	Sleep(2000);
//		EndWaitCursor();

}

/////////////////////////////////////////////////////////////////////////////
// CMyCursorView diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CMyCursorView message handlers

BOOL CMyCursorView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
	// TODO: Add your message handler code here and/or call default
	HCURSOR  hcursor;
	hcursor=AfxGetApp( )->LoadCursor(IDC_HAND);		// 加载自定义光标  
	SetCursor(hcursor);								// 设置光标
	return TRUE;   // return CView::OnSetCursor(pWnd, nHitTest, message);
}

void CMyCursorView::OnViewSyscur() 
{
	// TODO: Add your command handler code here
	CMyDlg  dlg;
	dlg.DoModal();
}

⌨️ 快捷键说明

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