CXTPDockingPane* CMainFrame::CreatePane(int x, int y, CRuntimeClass* pNewViewClass, CString strFormat, XTPDockingPaneDirection direction, CXTPDockingPane* pNeighbour) { //做个标记 int nID = ++m_nCount; CXTPDockingPane* pwndPane = m_paneManager.CreatePane(nID, CRect(0, 0,x, y), direction, pNeighbour); CString strTitle; strTitle.Format(strFormat, nID); pwndPane->SetTitle(strTitle); pwndPane->SetIconID(nID % 6 + 1); CFrameWnd* pFrame = new CFrameWnd; CCreateContext context; context.m_pNewViewClass = pNewViewClass; context.m_pCurrentDoc = GetActiveView()->GetDocument(); pFrame->Create(NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), this, NULL, 0, &context); pFrame->ModifyStyleEx(WS_EX_CLIENTEDGE, 0); m_mapPanes.SetAt(nID, pFrame); return pwndPane; }
void gkToolBarPaneBase::RegisterPane( CWnd* pCtrl, const TCHAR* name, XTPDockingPaneDirection dockdir, CSize constrain, int dockoption ) { NameIDMap::iterator it = m_paneMap.find(name); if (it == m_paneMap.end()) { CXTPDockingPane* pane = m_paneManager.CreatePane( ++m_paneIDCounter, CRect(0, 0, 100, 120), dockdir ); pane->SetTitle(name); pane->SetOptions(dockoption); pane->Attach( pCtrl ); m_paneManager.ShowPane(pane); //pane->SetMinTrackSize(constrain); pane->SetMaxTrackSize(constrain); m_paneMap[name] = m_paneIDCounter; } }