先初始化新的view再删除旧的view就可以了 void CMainFrame::OnChangeView(CSplitterWnd *pSplitter, int row, int col, CRuntimeClass *pViewClass)
{
// TODO: Add your command handler code here
CWnd *pOldPane = pSplitter->GetPane(row, col);
if (pOldPane->IsKindOf(pViewClass))
{
return;
} CRect rect;
pOldPane->GetWindowRect(rect); CView *pCurrentView = (CView *)pOldPane; CDocument *pDoc = pCurrentView->GetDocument(); BOOL pAutoDel = pDoc->m_bAutoDelete;
pDoc->m_bAutoDelete = FALSE; pOldPane->DestroyWindow(); pDoc->m_bAutoDelete = pAutoDel; CCreateContext pContext;
pContext.m_pNewDocTemplate = NULL;
pContext.m_pLastView = NULL;
pContext.m_pCurrentFrame = this; pContext.m_pNewViewClass = pViewClass;
pContext.m_pCurrentDoc = pDoc; pSplitter->CreateView(row, col, pViewClass, rect.Size(), &pContext);
CWnd *pNewPane = pSplitter->GetPane(row, col); pSplitter->ScreenToClient(rect);
pNewPane->MoveWindow(rect, TRUE);

CActListView *pActView = (CActListView *)pNewPane;
pActView->OnInitialUpdate();
m_pViewClass = pViewClass;
return;
}

解决方案 »

  1.   

    我觉得应该可以,实际上这就是一个多视图的问题。你可以看看相关的资料。<MFC经典问答>上好像就有。
      

  2.   

    得自己做,不能使用一般的doc/view/frame支持了。
    是不是可以这样:
    初始时创建你想要CView2对象,并且Hide;在需要时,Hide CView1对象,Show CView2对象。
      

  3.   

    呜呼呀!codeguru全是这种例子
    http://www.codeguru.com/doc_view/index.shtml