Solved

Resize Property Page/Sheet in Wizard mode

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Separate files macro - Errors on larger data set 18 70
Importing Special Characters in Dynamics GP Through Integration Manager 3 76
if loop in java 3 142
Message not shown 5 50
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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

810 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