我的操作如下,我在建MFC时候选择了分栏选项
我在mainfrm里面添加了个m_wndSplitter2 应为我想做3个的分栏
然后在mainfrm.cpp里面添加了#include "CETView.h"
这是我的分栏函数:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,
CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
/*return m_wndSplitter.Create(this,
1, 2,               // TODO: 调整行数和列数
CSize(100, 100),      // TODO: 调整最小窗格大小
pContext);*/
if (!m_wndSplitter.CreateView(0, 0,
pContext->m_pNewViewClass, CSize(200, 50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
} // add the second splitter pane - which is a nested splitter with 2 rows
if (!m_wndSplitter2.CreateStatic(
&m_wndSplitter,     // our parent window is the first splitter
2, 1,               // the new splitter is 2 rows, 1 column
WS_CHILD | WS_VISIBLE | WS_BORDER,  // style, WS_BORDER is needed
m_wndSplitter.IdFromRowCol(0, 1)
// new splitter is in the first row, 2nd column of first splitter
   ))
{
TRACE0("Failed to create nested splitter\n");
return FALSE;
}
// now create the two views inside the nested splitter
int cyText = max(lpcs->cy - 70, 20);    // height of text pane
if (!m_wndSplitter2.CreateView(0, 0,
RUNTIME_CLASS(CCETView), CSize(450, 250), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
if (!m_wndSplitter2.CreateView(1, 0,
RUNTIME_CLASS(CCETView), CSize(250, 250), pContext))
{
TRACE0("Failed to create third pane\n");
return FALSE;
}
//  three different views
return TRUE;
}
然后编译器报错:
 error C2143: 语法错误 : 缺少“;”(在“*”的前面)
 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
 error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
 warning C4183: “GetDocument”: 缺少返回类型;假定为返回“int”的成员函数
矛头全指向了这个类的
class CCETView : public CView
{
protected: // 仅从序列化创建
CCETView();
DECLARE_DYNCREATE(CCETView)// 属性
public:
CCETDoc* GetDocument() const;  //矛头全指向了这个类的这里  ,困惑啊我!!求解决方法// 操作
public:// 重写
public:
virtual void OnDraw(CDC* pDC);  // 重写以绘制该视图
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);// 实现
public:
virtual ~CCETView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endifprotected:// 生成的消息映射函数
protected:
DECLARE_MESSAGE_MAP()
};