Solved

Resize Property Page/Sheet in Wizard mode

Posted on 1998-12-03
1
666 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 20 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
no14 challenge 14 62
zeroMAx challenge 20 88
mapAB Challlenge 35 126
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now