我建立了一个单文档CuteFTP,生成的视类为 CCuteFTPView,同时在增加了一个对话框,并生成对话框的类class CParientView : public CDialog.而后,我希望界面上右边停靠对话框,左边是CCuteFTPView,于是用了如下语句:
1.在Cmainfrm.h中我们将增加下面的代码:
CSplitterWnd m_wndSplitter;2.重载CMainFrame::OnCreateClient()函数:
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{ if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CCuteFTPView),CSize(100,100), pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CParientView),CSize(100,100),pContext);
...
}
结果编译出错,如下:
F:\ECGVIEW\MainFrm.cpp(132) : error C2039: 'classCParientView' : is not a member of 'CParientView'
f:\ecgview\parientview.h(13) : see declaration of 'CParientView'
F:\ECGVIEW\MainFrm.cpp(132) : error C2065: 'classCParientView' : undeclared identifier
1.在Cmainfrm.h中我们将增加下面的代码:
CSplitterWnd m_wndSplitter;2.重载CMainFrame::OnCreateClient()函数:
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{ if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CCuteFTPView),CSize(100,100), pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CParientView),CSize(100,100),pContext);
...
}
结果编译出错,如下:
F:\ECGVIEW\MainFrm.cpp(132) : error C2039: 'classCParientView' : is not a member of 'CParientView'
f:\ecgview\parientview.h(13) : see declaration of 'CParientView'
F:\ECGVIEW\MainFrm.cpp(132) : error C2065: 'classCParientView' : undeclared identifier
我用了formView了,可是现在又有问题,运行到m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CParientView),CSize(100,100),pContext); 时候,发生异常,程序终止了,郁闷啊你的切分次序对吗?具体你想切分成什么样子?