100分,创建分割视图中出现的有关问题
100分求助,创建分割视图中出现的问题?
我建立了一个单文档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
------解决方案--------------------
全部代码~~~~你的class CParientView 是不是写成 classCParientView?
------解决方案--------------------
class CParientView : public CDialog. 不能从CDialog 继承吧,应该先从cview中继承,然后再贴dialog 上去
------解决方案--------------------
用CFormView
------解决方案--------------------
会切分view,不会停靠。
------解决方案--------------------
回复:
我用了formView了,可是现在又有问题,运行到m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CParientView),CSize(100,100),pContext); 时候,发生异常,程序终止了,郁闷啊
你的切分次序对吗?具体你想切分成什么样子?
------解决方案--------------------
左边的View选择基类CFormView,右边的保持原来的CView
------解决方案--------------------
对话框的stytle设成child,默认是popup!
我建立了一个单文档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
------解决方案--------------------
全部代码~~~~你的class CParientView 是不是写成 classCParientView?
------解决方案--------------------
class CParientView : public CDialog. 不能从CDialog 继承吧,应该先从cview中继承,然后再贴dialog 上去
------解决方案--------------------
用CFormView
------解决方案--------------------
会切分view,不会停靠。
------解决方案--------------------
回复:
我用了formView了,可是现在又有问题,运行到m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CParientView),CSize(100,100),pContext); 时候,发生异常,程序终止了,郁闷啊
你的切分次序对吗?具体你想切分成什么样子?
------解决方案--------------------
左边的View选择基类CFormView,右边的保持原来的CView
------解决方案--------------------
对话框的stytle设成child,默认是popup!