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

📄 psheetminiframewnd.cpp

📁 这是MFC经典问答书的光盘内容
💻 CPP
字号:
// PSheetMiniFrameWnd.cpp : implementation file
//

#include "stdafx.h"
#include "PropertySheetInMiniFrame.h"
#include "PSheetMiniFrameWnd.h"

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

/////////////////////////////////////////////////////////////////////////////
// CPSheetMiniFrameWnd

IMPLEMENT_DYNCREATE(CPSheetMiniFrameWnd, CMiniFrameWnd)

CPSheetMiniFrameWnd::CPSheetMiniFrameWnd()
{
}

CPSheetMiniFrameWnd::~CPSheetMiniFrameWnd()
{
}


BEGIN_MESSAGE_MAP(CPSheetMiniFrameWnd, CMiniFrameWnd)
	//{{AFX_MSG_MAP(CPSheetMiniFrameWnd)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

///////////////////////////////////////////////////////////
// EkCreateEmbeddedPropertySheet

BOOL EkCreateEmbeddedPropertySheet(	CWnd* pParent, CPropertySheet* pPSheet,
									DWORD dwStyle = WS_CHILD | WS_VISIBLE,
									DWORD dwExStyle = 0 )
{
	ASSERT_VALID( pParent );
	ASSERT_VALID( pPSheet );

	// 1 - Create the embedded property sheet window
	if( !pPSheet->Create( pParent,  dwStyle, dwExStyle ) )
	{
		TRACE0( "Embedded property sheet creation failed\n" );
		return FALSE;
	}

	// 2 - Add WS_TABSTOP and WS_EX_CONTROLPARENT to the property sheet styles
	pPSheet->ModifyStyle( 0, WS_TABSTOP );
	pPSheet->ModifyStyleEx ( 0, WS_EX_CONTROLPARENT );

	// 3 - Add WS_EX_CONTROLPARENT to the parent window styles
	pParent->ModifyStyleEx ( 0, WS_EX_CONTROLPARENT );

	return TRUE;
}

/////////////////////////////////////////////////////////////////////////////
// CPSheetMiniFrameWnd message handlers

int CPSheetMiniFrameWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	// 1 - Call base class to create the mini-frame window
	if (CMiniFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// 2 - Create the embedded property sheet
	if( !EkCreateEmbeddedPropertySheet( this, &m_psheet ) )
	{
		return -1;
	}

	// 3 - Resize the mini frame window to fit the property sheet
	CRect rcSheet;
	m_psheet.GetWindowRect( &rcSheet );

	CRect rcMiniFrame( rcSheet );
	CalcWindowRect( &rcMiniFrame );
	SetWindowPos(	NULL, 0, 0,
					rcMiniFrame.Width(), rcMiniFrame.Height(),
					SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE );

	// 4 - Center the mini-frame window on the screen
	CenterWindow();
	ShowWindow( SW_SHOW );

	return 0;
}

⌨️ 快捷键说明

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