MFC中设置某个VIEW为当前视图
1 //MainFrame中获取Doc,通过Doc遍历视图 2 CCR17CADDoc *pDoc = (CCR17CADDoc *)GetActiveDocument(); 3 CCR17CADView *pCADView = NULL; 4 if (pDoc != NULL) 5 { 6 POSITION posView = pDoc->GetFirstViewPosition(); 7 while(posView) 8 { 9 CView *pView = (CView *)pDoc->GetNextView(posView); 10 //如果是我们要找的视图,设置为当前视图,并跳出循环 11 if(pView->IsKindOf(RUNTIME_CLASS(CCR17CADView))) 12 { 13 pCADView = (CCR17CADView *)pView; 14 SetActiveView(pCADView); 15 break; 16 } 17 } 18 }