Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Resize Property Page/Sheet in Wizard mode

Posted on 1998-12-03
1
Medium Priority
?
730 Views
Last Modified: 2013-11-20
I have a wizard made up of property pages on a property sheet.

Multiple pages with Next/Back etc.

I want the last page (only) to automatically size it self to cover pretty much the whole screen.  Can get screen size using GetSystemMetrics.  Any ideas how to resize the last property page of a wiz to the screen on the fly, n.b. I need to resize back to original size if the user presses back button.

Please remember I've set Wizard mode if this makes a difference.

Thanks
0
Comment
Question by:Answers2000
1 Comment
 
LVL 1

Accepted Solution

by:
hbuehler earned 60 total points
ID: 1325717
Hi!

1) changing size of the property sheet (it doesn't matter whether it is a wizard or not):

You can achive this by calling SetWindowPlacement() or an equal function on the sheet. Afterwards, you must even resize your page by SetWindowPlacement().

However, if you do so, the controls ("next","finish" etc.) won't automatically change their location.
You can add a WM_SIZE message handler to the _sheet_ and reposition these controls by hand (I suggest you even overwrite OnInitDialog() (this exists :) to initially read in their original positions.

You need to reposition the controls with the following codes:

ID_WIZNEXT,
ID_WIZFINISH,
ID_WIZBACK,
IDOK,
IDCANCEL,
ID_WIZNEXT,
ID_APPLY_NOW,
IDHELP,
AFX_IDC_TAB_CONTROL,
ID_WIZFINISH+1,      /* the bevel line*/

You can get a CWnd to the controls by using GetDlgItem()
(assuming you have __max control ids in an array m_ids[__max+1]
and some WINDOWPLACEMENT structures in m_wpl[__max+1]):

for(int i=0;i=<__max;++i)
{
  if(CWnd *pCtrl = CPropertySheet::GetDlgItem(m_ids[i]))
    pCtrl->GetWindowPlacement(m_wpl[i]);
}

2) Changing your sheet's size:

You can overwrite the page's OnSetActive().

use the following (pseudo-)code:

 BigPage::OnSetActive()
 {
   m_pSheet->GetWindowPlacement(&wpl_sheet_backup);
   GetWindowPlacement(&wpl_page_backup);

   m_pSheet->SetWindowPlacement(&wpl_sheet_big);
   // m_pSheet is a pointer to your sheet; you could use
   // GetParent() if you don't like to hold one.
   // Since you catch WM_SIZE to reposition the controls,
   // they'll be put to the right position.

   SetWindowPlacement(&wpl_page_big);
   // set BigPages' size
 
   ...
 }

To resize the sheet if going back, catch the virtual function
OnWizardBack():

 BigPage::OnWizardBack()
 {
   SetWindowPlacement(&wpl_backup_page);
   m_pSheet->SetWindowPlacement(&wpl_backup_sheet);
   ...
 }

That should work.

NOTE: If you may want to make use of my code which gives you reizable sheets at all, have a look at http://www.codeguru.com (one of the finest MFC sites :) BUT - Unfortunately it hasn't been published yet (I sent it there yesterday) ... so maybe you have to wait some days :(

- Hans



0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question