要想在窗口上创建停靠窗口pane有如下方式: //变量定义:CXTPDockingPaneManager m_paneManager;
1. 添加视图到pane显示
Attach 视图
CXTPDockingPane *pPane = m_paneManager.CreatePane(ID_PANE_INFO, rectMainFrame, xtpPaneDockRight);
pPane->SetTitle("详细信息");
pPane->AttachView(this, RUNTIME_CLASS(CONUMenuConfigView));
2. 添加CWnd控件到pane显示
Attach CWnd
//变量类型
class CPropertyPane : public CWnd{...}
CPropertyPane m_ALarmDictionary;
m_Dictionary.Create(_T("STATIC"), NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
CXTPEmptyRect(), this, 0); //用户自己创建的CWND控件一定要用系统自带的名称:STATIC BUTTON
CXTPDockingPane* pPane = m_paneManager.CreatePane(ID_PANE_DICTIONARY,
CRect(0, 0, 260, 500), xtpPaneDockRight);
pPane->SetTitle(AnmsGetSentence(IDS_ALARM_DETAILED_INFO));
pPane->Close();
pPane->Attach(&m_Dictionary);
3. 添加Frame到pane显示
Attach Frame
CXTPDockingPane *pPane= m_paneManager.CreatePane(IDD_USERSET_PANE, CRect(0, 0, 260, 500), xtpPaneDockRight);
m_pUserPane= (CUserSetPaneFrame*)(RUNTIME_CLASS(CUserSetPaneFrame)->CreateObject());
m_pUserPane->Create(NULL, NULL, WS_CHILD | WS_VISIBLE & (~WS_EX_DLGMODALFRAME), CXTPEmptyRect(), this, 0);
m_pUserPane->SetParentViewWnd(pView->GetSafeHwnd());
pPane->SetTitle(AnmsGetSentence(310119));
pPane->SetMinTrackSize(CSize(400, 500));
pPane->Attach(m_pUserSetPane);
注明:CXTPDockingPaneManager m_paneManager使用时一定调用如下函数,否则无法正常使用。
m_paneManager.InstallDockingPanes(this);