📄 formsheet.cpp
字号:
// FormSheet.cpp : 实现文件
//
#include "stdafx.h"
#include "Temperature.h"
#include "FormSheet.h"
#include "ViewPage.h"
#include "ListPage.h"
// CFormSheet
CString g_strGraphic;
CString g_strListReport;
IMPLEMENT_DYNAMIC(CFormSheet, CPropertySheet)
CFormSheet::CFormSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
InitPage();
}
CFormSheet::CFormSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
InitPage();
}
CFormSheet::~CFormSheet()
{
DestroyPage();
}
BEGIN_MESSAGE_MAP(CFormSheet, CPropertySheet)
ON_WM_SIZE()
ON_WM_CREATE()
END_MESSAGE_MAP()
void CFormSheet::InitPage()
{
m_pViewPage = new CViewPage();
g_strGraphic.LoadString( IDS_STR_PAGE_GRAPHIC );
m_pViewPage->m_psp.dwFlags |= PSP_USETITLE;
m_pViewPage->m_psp.pszTitle = g_strGraphic;
if( m_pViewPage ) AddPage( m_pViewPage );
m_pListPage = new CListPage();
g_strListReport.LoadString( IDS_STR_PAGE_LIST );
m_pListPage->m_psp.dwFlags |= PSP_USETITLE;
m_pListPage->m_psp.pszTitle = g_strListReport;
if( m_pListPage ) AddPage( m_pListPage );
}
void CFormSheet::DestroyPage()
{
if( m_pViewPage )
{
RemovePage( m_pViewPage );
delete m_pViewPage;
m_pViewPage = NULL;
}
if( m_pListPage )
{
RemovePage( m_pListPage );
delete m_pListPage;
m_pListPage = NULL;
}
}
void CFormSheet::OnSize(UINT nType, int cx, int cy)
{
CPropertySheet::OnSize(nType, cx, cy);
/*
CRect rect;
CTabCtrl *pTabCtrl = this->GetTabControl();
if( pTabCtrl )
{
if( IsWindow( pTabCtrl->m_hWnd ) )
{
pTabCtrl->GetClientRect( &rect );
TRACE1( "height:%d\n", rect.Height() );
}
}
if( m_pListPage )
{
if( IsWindow( m_pListPage->m_hWnd ) )
{
m_pListPage->MoveWindow( 0, rect.Height(), cx, cy - rect.Height() );
}
}
if( m_pViewPage )
{
if( IsWindow( m_pViewPage->m_hWnd ) )
{
m_pViewPage->MoveWindow( 0, rect.Height(), cx, cy - rect.Height() );
}
}
*/
}
void CFormSheet::PushBackToList( LPCTSTR strItem, LPCTSTR strItemText1, LPCTSTR strItemText2 )
{
if( m_pListPage )
{
if( IsWindow( m_pListPage->m_hWnd ) )
{
m_pListPage->PushBackToList( strItem, strItemText1, strItemText2 );
}
}
}
void CFormSheet::DeleteAllItems()
{
if( m_pListPage )
{
if( IsWindow( m_pListPage->m_hWnd ) )
{
m_pListPage->DeleteAllItems();
}
}
}
int CFormSheet::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CPropertySheet::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
void CFormSheet::SetHistoryData( char* pTempertureArray, unsigned int TempCount, unsigned int StartTemperature )
{
if( m_pViewPage )
{
m_pViewPage->SetHistoryData( pTempertureArray, TempCount, StartTemperature );
}
}
BOOL CFormSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
//SetActivePage( 1 );
return bResult;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -