0

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.

Kyle Williamson
  • 2,251
  • 6
  • 43
  • 75
  • You do realize that what you have really isn't a property sheet any more. It's just a tabbed dialog. – Raymond Chen Mar 13 '15 at 19:24
  • 1
    Alright. Well technically it was created from CPropertySheet and contains tabs of CPropertyPages. MSDN says that tabbed dialog is another name for propertysheet. Quoted from MSDN: "_Represents property sheets, also known as tab dialog boxes_". – Kyle Williamson Mar 13 '15 at 19:31
  • Property sheets are tabbed dialog boxes that have space at the bottom for the special buttons. The special buttons are part of the definition of property sheet. MSDN is being sloppy in its terminology. – Raymond Chen Mar 13 '15 at 19:54
  • Okay, thanks. Do you know of a way for me to easily switch what I have to a tabbed dialog box that does not contain a gap? – Kyle Williamson Mar 13 '15 at 20:13

1 Answers1

1

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;
}
rrirower
  • 4,338
  • 4
  • 27
  • 45