[英]MFC: How to Identfy if Dialog was created using CPropertySheet or CTabCtrl
[英]Removing gap underneath pages on CPropertySheet / Tabbed Dialog
我有一个CPropertySheet,用于显示三个CPropertyPages。 我删除了默认的“应用”和“帮助”按钮。 我的问题是,既然它们已被移走,我曾经所在的地方还有很大的空白。 有没有办法消除这种差距? 谢谢!
这是我所说的差距的照片:
在卸下按钮之前,它们位于间隙的右侧。 请注意,“更改选项”页面是在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;
如果需要其他详细信息,我将进行编辑。 谢谢。
用属性表实现这种外观。
您需要在工作表中处理OnitDialog并调整其大小。 例如,结合使用CPropertySheet :: GetPage和CWnd :: 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;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.