启动时如何用代码选择某一指定View ?

解决方案 »

  1.   

    CView* pOldActiveView = GetActiveView();CRuntimeClass* pNewViewClass;
    pNewViewClass = RUNTIME_CLASS(COtherView);
    CCreateContext context;
    context.m_pNewViewClass = pNewViewClass;
    context.m_pCurrentDoc = GetActiveDocument();
    CView* pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
    if (pNewView != NULL)
    {
    // the new view is there, but invisible and not active...
    pNewView->ShowWindow(SW_SHOW);
             RecalcLayout();
             pOldActiveView->DestroyWindow();
    }