7 个解决方案
#1
http://support.microsoft.com/kb/143291/zh-cn
#2
http://www.vckbase.com/document/viewdoc/?id=398
#3
CPropertySheet sheet;
sheet.AddPage(&dia1);
sheet.AddPage(&dia2);
sheet.Create(this,WS_VISIBLE|WS_CHILD,WS_EX_CONTROLPARENT);
sheet.SetWindowPos(NULL,0,0,100,150,SWP_NOACTIVATE|SWP_NOZORDER);
sheet.AddPage(&dia1);
sheet.AddPage(&dia2);
sheet.Create(this,WS_VISIBLE|WS_CHILD,WS_EX_CONTROLPARENT);
sheet.SetWindowPos(NULL,0,0,100,150,SWP_NOACTIVATE|SWP_NOZORDER);
#4
http://support.microsoft.com/kb/300606
#5
这里有微软的官方指导文档和相应的代码
http://support.microsoft.com/kb/143291/en-us
Sample Code
http://support.microsoft.com/kb/143291/en-us
Sample Code
/* Compile options needed: default
*/
// This example adds 50 pixels to the width and height of
// each page. CMySheet is derived from CPropertySheet. m_PageRect is a
// member variable of CMySheet and is of type RECT. WM_RESIZEPAGE is a
// user-defined message.
// ... prototypes that need to be added to your class definition
class CMySheet : public CPropertySheet
{
// ... other members
// ... make sure you have these members
protected:
RECT m_PageRect;
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual BOOL OnInitDialog();
afx_msg LRESULT OnResizePage(WPARAM wParam, LPARAM lParam);
afx_msg void OnApplyNow();
};
// ... modify and/or implement functions in the .cpp file...
#define WM_RESIZEPAGE WM_USER + 111
BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
//{{AFX_MSG_MAP(CMySheet)
// NOTE - the ClassWizard will add and remove mapping macros here.
// ... other message map entries
//}}AFX_MSG_MAP
// ... add the 2 following entries here
ON_MESSAGE (WM_RESIZEPAGE, OnResizePage)
ON_COMMAND (ID_APPLY_NOW, OnApplyNow)
END_MESSAGE_MAP()
BOOL CMySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
RECT rc;
// resize the sheet
GetWindowRect (&rc);
ScreenToClient (&rc);
rc.right += 50;
rc.bottom += 50;
MoveWindow (&rc);
// resize the CTabCtrl
CTabCtrl* pTab = GetTabControl ();
ASSERT (pTab);
pTab->GetWindowRect (&rc);
ScreenToClient (&rc);
rc.right += 50;
rc.bottom += 50;
pTab->MoveWindow (&rc);
// resize the page
CPropertyPage* pPage = GetActivePage ();
ASSERT (pPage);
// store page size in m_PageRect
pPage->GetWindowRect (&m_PageRect);
ScreenToClient (&m_PageRect);
m_PageRect.right += 50;
m_PageRect.bottom += 50;
pPage->MoveWindow (&m_PageRect);
// move the OK, Cancel, and Apply buttons
CWnd* pWnd = GetDlgItem(IDOK);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
pWnd = GetDlgItem(IDCANCEL);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
pWnd = GetDlgItem(ID_APPLY_NOW);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
CenterWindow();
return TRUE;
}
LONG CMySheet::OnResizePage(UINT, LONG)
{
// resize the page using m_PageRect which was set in OnInitDialog()
CPropertyPage* pPage = GetActivePage ();
ASSERT (pPage);
pPage->MoveWindow (&m_PageRect);
return 0;
}
BOOL CMySheet::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pnmh = (LPNMHDR) lParam;
// the sheet resizes the page whenever it is activated
// so we need to resize it to what we want
if (TCN_SELCHANGE == pnmh->code)
// user-defined message needs to be posted because page must
// be resized after TCN_SELCHANGE has been processed
PostMessage (WM_RESIZEPAGE);
return CPropertySheet::OnNotify(wParam, lParam, pResult);
}
void CMySheet::OnApplyNow()
{
// the sheet resizes the page whenever the Apply button is clicked
// so we need to resize it to what we want
PostMessage (WM_RESIZEPAGE);
}
#6
想怎么修改,可以重载OnSetActive试试。
#7
http://www.vckbase.com/document/viewdoc/?id=398
#1
http://support.microsoft.com/kb/143291/zh-cn
#2
http://www.vckbase.com/document/viewdoc/?id=398
#3
CPropertySheet sheet;
sheet.AddPage(&dia1);
sheet.AddPage(&dia2);
sheet.Create(this,WS_VISIBLE|WS_CHILD,WS_EX_CONTROLPARENT);
sheet.SetWindowPos(NULL,0,0,100,150,SWP_NOACTIVATE|SWP_NOZORDER);
sheet.AddPage(&dia1);
sheet.AddPage(&dia2);
sheet.Create(this,WS_VISIBLE|WS_CHILD,WS_EX_CONTROLPARENT);
sheet.SetWindowPos(NULL,0,0,100,150,SWP_NOACTIVATE|SWP_NOZORDER);
#4
http://support.microsoft.com/kb/300606
#5
这里有微软的官方指导文档和相应的代码
http://support.microsoft.com/kb/143291/en-us
Sample Code
http://support.microsoft.com/kb/143291/en-us
Sample Code
/* Compile options needed: default
*/
// This example adds 50 pixels to the width and height of
// each page. CMySheet is derived from CPropertySheet. m_PageRect is a
// member variable of CMySheet and is of type RECT. WM_RESIZEPAGE is a
// user-defined message.
// ... prototypes that need to be added to your class definition
class CMySheet : public CPropertySheet
{
// ... other members
// ... make sure you have these members
protected:
RECT m_PageRect;
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
virtual BOOL OnInitDialog();
afx_msg LRESULT OnResizePage(WPARAM wParam, LPARAM lParam);
afx_msg void OnApplyNow();
};
// ... modify and/or implement functions in the .cpp file...
#define WM_RESIZEPAGE WM_USER + 111
BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
//{{AFX_MSG_MAP(CMySheet)
// NOTE - the ClassWizard will add and remove mapping macros here.
// ... other message map entries
//}}AFX_MSG_MAP
// ... add the 2 following entries here
ON_MESSAGE (WM_RESIZEPAGE, OnResizePage)
ON_COMMAND (ID_APPLY_NOW, OnApplyNow)
END_MESSAGE_MAP()
BOOL CMySheet::OnInitDialog()
{
CPropertySheet::OnInitDialog();
RECT rc;
// resize the sheet
GetWindowRect (&rc);
ScreenToClient (&rc);
rc.right += 50;
rc.bottom += 50;
MoveWindow (&rc);
// resize the CTabCtrl
CTabCtrl* pTab = GetTabControl ();
ASSERT (pTab);
pTab->GetWindowRect (&rc);
ScreenToClient (&rc);
rc.right += 50;
rc.bottom += 50;
pTab->MoveWindow (&rc);
// resize the page
CPropertyPage* pPage = GetActivePage ();
ASSERT (pPage);
// store page size in m_PageRect
pPage->GetWindowRect (&m_PageRect);
ScreenToClient (&m_PageRect);
m_PageRect.right += 50;
m_PageRect.bottom += 50;
pPage->MoveWindow (&m_PageRect);
// move the OK, Cancel, and Apply buttons
CWnd* pWnd = GetDlgItem(IDOK);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
pWnd = GetDlgItem(IDCANCEL);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
pWnd = GetDlgItem(ID_APPLY_NOW);
pWnd->GetWindowRect(&rc);
rc.bottom += 50;
rc.top += 50;
ScreenToClient(&rc);
pWnd->MoveWindow(&rc);
CenterWindow();
return TRUE;
}
LONG CMySheet::OnResizePage(UINT, LONG)
{
// resize the page using m_PageRect which was set in OnInitDialog()
CPropertyPage* pPage = GetActivePage ();
ASSERT (pPage);
pPage->MoveWindow (&m_PageRect);
return 0;
}
BOOL CMySheet::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
NMHDR* pnmh = (LPNMHDR) lParam;
// the sheet resizes the page whenever it is activated
// so we need to resize it to what we want
if (TCN_SELCHANGE == pnmh->code)
// user-defined message needs to be posted because page must
// be resized after TCN_SELCHANGE has been processed
PostMessage (WM_RESIZEPAGE);
return CPropertySheet::OnNotify(wParam, lParam, pResult);
}
void CMySheet::OnApplyNow()
{
// the sheet resizes the page whenever the Apply button is clicked
// so we need to resize it to what we want
PostMessage (WM_RESIZEPAGE);
}
#6
想怎么修改,可以重载OnSetActive试试。
#7
http://www.vckbase.com/document/viewdoc/?id=398