Visual c++ CDockablePane在停靠到另一个窗格时不保存布局

Visual c++ CDockablePane在停靠到另一个窗格时不保存布局,visual-c++,layout,mfc,panel,dockable,Visual C++,Layout,Mfc,Panel,Dockable,在MFC应用程序中,有两个派生的CDockablePane对象停靠在主视图的任一侧 下面是创建其中一个窗格的代码。第二个是类似的 if(m_dlgPane && m_dlgPane->GetSafeHwnd()) { m_dlgPane->ShowPane(TRUE,FALSE,TRUE); //RecalcLayout(); return ; } m_dlgPane = new CDialogPane; ((CDialogPane*)m_d

在MFC应用程序中,有两个派生的CDockablePane对象停靠在主视图的任一侧

下面是创建其中一个窗格的代码。第二个是类似的

if(m_dlgPane && m_dlgPane->GetSafeHwnd())
{
    m_dlgPane->ShowPane(TRUE,FALSE,TRUE);
    //RecalcLayout();
    return ;
}
m_dlgPane = new CDialogPane; 
((CDialogPane*)m_dlgPane)->m_wndDlg = new CPaneChildDlg();
((CDialogPane*)m_dlgPane)->nDlgID = CPaneChildDlg::IDD;

UINT style = WS_CHILD | CBRS_RIGHT | CBRS_FLOAT_MULTI;
CString strTitle = _T("Child Dialog Pane");
if (!m_dlgPane->Create(strTitle, this, CRect(0, 0, 300, 400), TRUE,
    IDC_DIALOG_PANE, style,AFX_CBRS_OUTLOOK_TABS))
{
    TRACE0("Failed to create dialog pane\n");
    SAFE_DELETE(m_dlgPane);
    return ; 
}
m_dlgPane->EnableDocking(CBRS_ALIGN_ANY);
DockPane((CBasePane*)m_dlgPane,AFX_IDW_DOCKBAR_RIGHT);

m_dlgPane->ShowPane(TRUE, FALSE, TRUE);
m_dlgPane->RecalcLayout();
windows通过LoadState和SaveState方法保存布局。并被框架调用

BOOL CDialogPane::SaveState(LPCTSTR lpszProfileName, int nIndex, UINT uiID)
{
    return CDockablePane::SaveState(lpszProfileName, nIndex, uiID);
}

BOOL CDialogPane::LoadState(LPCTSTR lpszProfileName, int nIndex, UINT uiID)
{
    return CDockablePane::LoadState(lpszProfileName, nIndex, uiID); 
}

每次应用程序启动时正确加载布局。除了一个窗格2停靠到另一个窗格1之外。似乎它不记得或加载窗格2的正确高度。虽然这在应用程序的整个生命周期内都有效,但在应用程序存在并再次打开时则不起作用

这里也有同样的问题。有进展吗?@manattttta Implement BOOL LoadStateLPCTSTR lpszSectionName=NULL,cframeinpl*pframeinpl=NULL;虚拟BOOL SaveStateLPCTSTR lpszSectionName=NULL,cframeinpl*pframeinpl=NULL;在[YourApp].cpp类上。我不确定CDockingManager::SetDockingModeDT\u是否智能;不管有没有帮助,但我确实设置了它。