删除CPropertySheet /选项卡式对话框下页面的间隙

问题描述:

我有一个CPropertySheet,用于显示三个CPropertyPages。我删除了默认的“应用”和“帮助”按钮。我的问题是,现在他们被删除,我曾经有一个很大的差距,他们曾经位于。有没有办法消除这个差距?谢谢!删除CPropertySheet /选项卡式对话框下页面的间隙

这里的差距图片我说的: Gap

按钮被拆除之前,他们是位于间隙的右侧。请注意,“更改选项”页面是在Visual Studio的设计器中创建的,页面在“打印”按钮的正下方结束。主要的管理选项CPropertySheet完全由代码创建。 这里是初始化的CPropertySheet和页面(和去除“帮助”和“应用”按钮的代码:

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; 

是否需要进一步的细节,我会编辑谢谢。

+0

你确实意识到你真的不再是一个属性表。这只是一个选项卡式对话框。 – 2015-03-13 19:24:59

+0

好的。从技术上讲,它是从CPropertySheet创建的,并包含CPropertyPages的选项卡。 MSDN表示该选项卡式对话框是propertysheet的另一个名称。从MSDN引用:“_Represents属性表,也称为选项卡对话框_”。 – 2015-03-13 19:31:45

+0

属性表是带有空格的特殊按钮底部的选项卡式对话框。特殊按钮是属性表定义的一部分。 MSDN在其术语上是sl py不驯的。 – 2015-03-13 19:54:08

为了实现这种带有属性表一看....

enter image description here

您需要处理表格中的OnitDialog并重新调整它的大小。例如,使用CPropertySheet::GetPageCWnd::MoveWindow的组合可以实现您想要的功能。

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; 
}