Removing gap underneath pages on CPropertySheet / Tabbed Dialog

420 Views Asked by At

I have a CPropertySheet that I am using to show three CPropertyPages. I removed the default "Apply" and "Help" buttons. My problem comes that now that they are removed, I have a large gap where they were once located. Is there a way to remove this gap? Thanks!

Here is a picture of the gap I speak of: Gap

Before the buttons were removed, they were located to the right side of the gap. Please note that the "Change Options" page was created in Visual Studio's designer and the page ends right under the Print button. The main Admin Options CPropertySheet was created entirely from code. Here is the code to initialize the CPropertySheet and pages (and the removal of the "Help" and "Apply" buttons:

BEGIN_MESSAGE_MAP(CSLIMOptCplusplusApp, CWinApp)
//ON_COMMAND(ID_HELP, &CWinApp::OnHelp) Commented out to remove the "Help" button
END_MESSAGE_MAP()

BOOL OptCplusplusApp::InitInstance()
{
CWinApp::InitInstance();
SQLHENV m_1;
EnvGetHandle(m_1);

Login lgn;   //Creates a Login dialog for the user to enter credentials.
lgn.DoModal();

CImageSheet*      imagedlg = new CImageSheet( "SLIM Admin Options" );
CImageDisplay*    pageImageDisplay    = new CImageDisplay;
CImageDimensions* pageImageDimensions = new CImageDimensions;
ListOption*       pageListOption      = new ListOption;

ASSERT( imagedlg );
ASSERT( pageImageDisplay );
ASSERT( pageImageDimensions );  
ASSERT( pageListOption );

imagedlg->AddPage( pageListOption);
imagedlg->AddPage( pageImageDisplay );
imagedlg->AddPage( pageImageDimensions );

imagedlg->m_psh.dwFlags |= PSH_NOAPPLYNOW;  //Removes the default Apply button
imagedlg->Create();
imagedlg->ShowWindow( SW_SHOW );
m_pMainWnd = imagedlg;

I will edit if any further details are needed. Thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

To achieve this kind of a look with a property sheet....

enter image description here

You need to handle OnitDialog within the sheet and re-size it. For example, using a combination of CPropertySheet::GetPage and CWnd::MoveWindow will accomplish what you want.

BOOL MyPropSheet::OnInitDialog()
    {
    BOOL bResult = CPropertySheet::OnInitDialog();

    // TODO:  Add your specialized code here
    CPropertyPage* pg1 = GetPage(0);
    CRect rect(0, 0, 0, 0);

    pg1->GetWindowRect(&rect);

    CRect thisRect(0, 0, 0, 0);
    GetWindowRect(&thisRect);

    thisRect.bottom = rect.bottom + 16;
    MoveWindow(&thisRect);
return bResult;
}