cursor.cpp

来自「可以实现」· C++ 代码 · 共 82 行

CPP
82
字号
// CURSOR.cpp : implementation file
//

#include "stdafx.h"
#include "df.h"
#include "CURSOR.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCURSOR dialog


CCURSOR::CCURSOR(CWnd* pParent /*=NULL*/)
	: CDialog(CCURSOR::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCURSOR)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCURSOR::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCURSOR)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCURSOR, CDialog)
	//{{AFX_MSG_MAP(CCURSOR)
	ON_WM_SETCURSOR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCURSOR message handlers

BOOL CCURSOR::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
 	switch(pWnd->GetDlgCtrlID())
	{	case IDC_PICTURE:
	{
		SetCursor(AfxGetApp()->LoadCursor(IDC_HAND));
	CWnd *p=GetDlgItem(IDC_TEXT);
    p->ShowWindow(SW_SHOW);
	p->SetWindowText("This is a picture");
	return TRUE;
	}
	break;

	
	case IDC_BUTTON1:
	{	
	SetCursor(AfxGetApp()->LoadCursor(IDC_HAND));
	//CWnd *p=
	GetDlgItem(IDC_TEXT)->ShowWindow(SW_SHOW);
	GetDlgItem(IDC_TEXT)->SetWindowText("This is a BUTTON");
	return TRUE;	}
	break;
		
	default:
		{
	CWnd *p=GetDlgItem(IDC_TEXT);
    p->ShowWindow(SW_HIDE);
	SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
	return TRUE;


		}
	}


	return CDialog::OnSetCursor(pWnd, nHitTest, message);
}

⌨️ 快捷键说明

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