허구언날 돌아댕기는 소스..
간혹 유용하더라..
하지만 2008년 이 글을 옮기는 시점까지 이 소스 한번 써봤다는거...
void CMainFrame::ChangeView(CMainFrame::MakerViewMode viewmode)
{
CString szFrameTitle = _T("");
CRuntimeClass* pNewViewClass;
CView* pActiveView = GetActiveView();
INT nViewIndex;
switch(viewmode)
{
case 1:
nViewIndex = 2;
pNewViewClass = RUNTIME_CLASS(CViewSwitchingView);
break;
case 2:
nViewIndex = 2;
pNewViewClass = RUNTIME_CLASS(CSecondView);
break;
}
CView* pNewView;
if(m_pViewArray[nViewIndex] == NULL)
{
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = GetActiveDocument();
pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
m_pViewArray[nViewIndex] = pNewView;
}
pNewView = m_pViewArray[nViewIndex];
pActiveView->ShowWindow(SW_HIDE);
SetActiveView(pActiveView,false); // 기능정지
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
SetActiveView(pNewView,true);
RecalcLayout();
}
간혹 유용하더라..
하지만 2008년 이 글을 옮기는 시점까지 이 소스 한번 써봤다는거...
void CMainFrame::ChangeView(CMainFrame::MakerViewMode viewmode)
{
CString szFrameTitle = _T("");
CRuntimeClass* pNewViewClass;
CView* pActiveView = GetActiveView();
INT nViewIndex;
switch(viewmode)
{
case 1:
nViewIndex = 2;
pNewViewClass = RUNTIME_CLASS(CViewSwitchingView);
break;
case 2:
nViewIndex = 2;
pNewViewClass = RUNTIME_CLASS(CSecondView);
break;
}
CView* pNewView;
if(m_pViewArray[nViewIndex] == NULL)
{
CCreateContext context;
context.m_pNewViewClass = pNewViewClass;
context.m_pCurrentDoc = GetActiveDocument();
pNewView = STATIC_DOWNCAST(CView, CreateView(&context));
m_pViewArray[nViewIndex] = pNewView;
}
pNewView = m_pViewArray[nViewIndex];
pActiveView->ShowWindow(SW_HIDE);
SetActiveView(pActiveView,false); // 기능정지
pNewView->ShowWindow(SW_SHOW);
pNewView->OnInitialUpdate();
SetActiveView(pNewView,true);
RecalcLayout();
}
반응형