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

📄 demodlg.cpp

📁 《MFC经典问答》pdf格式 拿出来大家共享一下
💻 CPP
字号:
// DemoDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DialogTooltips.h"
#include "DemoDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDemoDlg dialog


CDemoDlg::CDemoDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CDemoDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDemoDlg)
	m_nX = 0;
	m_nY = 0;
	m_nShape = -1;
	//}}AFX_DATA_INIT
}


void CDemoDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDemoDlg)
	DDX_Control(pDX, IDCANCEL, m_cmdCancel);
	DDX_Control(pDX, IDOK, m_cmdOK);
	DDX_Control(pDX, IDC_SHAPE, m_cmbShape);
	DDX_Control(pDX, IDC_Y, m_edtY);
	DDX_Control(pDX, IDC_X, m_edtX);
	DDX_Text(pDX, IDC_X, m_nX);
	DDX_Text(pDX, IDC_Y, m_nY);
	DDX_CBIndex(pDX, IDC_SHAPE, m_nShape);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDemoDlg, CDialog)
	//{{AFX_MSG_MAP(CDemoDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDemoDlg message handlers

BOOL CDemoDlg::PreTranslateMessage(MSG* pMsg) 
{
	// Relay events to the tooltip control
	m_ToolTip.RelayEvent( pMsg );
	return CDialog::PreTranslateMessage(pMsg);
}

BOOL CDemoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// 1 - Create the tooltip control
	if( !m_ToolTip.Create( this ) )
	{
	  TRACE0( "Unable to create ToolTip control\n" );
	}
	else
	{
		// 2 - Add the form view controls to the tooltip
		m_ToolTip.AddTool( &m_edtX, IDS_TT_X );
		m_ToolTip.AddTool( &m_edtY, IDS_TT_Y );
		m_ToolTip.AddTool( &m_cmbShape, IDS_TT_SHAPE );
		m_ToolTip.AddTool( &m_cmdOK, IDS_TT_OK );
		m_ToolTip.AddTool( &m_cmdCancel, IDS_TT_CANCEL );

		// 3 - Activate the tooltip control
		m_ToolTip.Activate( TRUE );
	}
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

⌨️ 快捷键说明

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