fspropertysheet1.cpp

来自「windows ce开发技巧与实例光盘代码」· C++ 代码 · 共 108 行

CPP
108
字号
// FSPropertySheet1.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "FSPropertySheet1.h"
#include "Page1Dlg.h"
#include "Page2Dlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFSPropertySheet

IMPLEMENT_DYNAMIC(CFSPropertySheet, CPropertySheet)

CFSPropertySheet::CFSPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
	AddPage(new CPage1Dlg());
	AddPage(new CPage2Dlg());
}

CFSPropertySheet::CFSPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
}

CFSPropertySheet::~CFSPropertySheet()
{
	if (m_pWndEmptyCB) {
		delete m_pWndEmptyCB;
	}
}


BEGIN_MESSAGE_MAP(CFSPropertySheet, CPropertySheet)
	//{{AFX_MSG_MAP(CFSPropertySheet)
	ON_WM_CLOSE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFSPropertySheet message handlers

BOOL CFSPropertySheet::OnInitDialog() 
{
	BOOL bResult = CPropertySheet::OnInitDialog();
	
	m_pWndEmptyCB = new CCeCommandBar;

	if(m_pWndEmptyCB != NULL) {
		((CCeCommandBar*)m_pWndEmptyCB)->CreateEx(this);
	}
	
	OnFullScreen();

	return bResult;
}

void CFSPropertySheet::OnFullScreen()
{

	#define MENU_HEIGHT 26
	RECT rc;

	//get window size
	GetWindowRect(&rc);

	::SHFullScreen(m_hWnd, SHFS_HIDETASKBAR | SHFS_HIDESIPBUTTON);
	::ShowWindow(m_pWndEmptyCB->m_hWnd, SW_HIDE);

	MoveWindow(rc.left, 
		rc.top-MENU_HEIGHT, 
		rc.right, 
		rc.bottom+MENU_HEIGHT, 
		TRUE);	

	CTabCtrl* pTabCtrl;
	RECT rect;

	// Resize tab control tied to the property sheet.
	pTabCtrl = GetTabControl();
	pTabCtrl->GetWindowRect(&rect);
	ScreenToClient(&rect);
	rect.bottom += MENU_HEIGHT;
	pTabCtrl->MoveWindow(&rect);
}

void CFSPropertySheet::OnClose() 
{
	RECT rc;
	GetWindowRect(&rc);
	SHFullScreen(m_hWnd, SHFS_SHOWTASKBAR | SHFS_SHOWSIPBUTTON);
	::ShowWindow(m_pWndEmptyCB->m_hWnd, SW_SHOW);
	MoveWindow( 
		rc.left, 
		rc.top+MENU_HEIGHT, 
		rc.right, 
		rc.bottom-(2*MENU_HEIGHT), 
		TRUE);   	
	
	CPropertySheet::OnClose();
}

⌨️ 快捷键说明

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