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

📄 demodlg.cpp

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

#include "stdafx.h"
#include "CenterDialog.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, 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()

///////////////////////////////////////////////////////////
// EkGetActiveFrame : function implementation
//
// Return the active frame window or NULL

CFrameWnd* EkGetActiveFrame()
{
	CWnd* pMainWnd = AfxGetMainWnd();
	ASSERT_VALID( pMainWnd );

	if( !pMainWnd->IsKindOf( RUNTIME_CLASS( CFrameWnd ) ) )
	{
		return NULL;
	}

	return static_cast<CFrameWnd*>( pMainWnd )
										->GetActiveFrame();
}

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

BOOL CDemoDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// Center our dialog window relative to the active
	// frame window
	CWnd* pActiveFrame = EkGetActiveFrame();
	ASSERT_VALID( pActiveFrame );
	CenterWindow( pActiveFrame );
	
	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 + -