VC++中創建切分窗口
1.使用向導創建SDI窗體,一切均取默認值
2.在CMainFrame類中增加切分控件成員
CSplitterWnd m_wndSplitter;3.在CMainFrame類的OnCreateClient方法(若沒有此方法使用“增加虛函數”向導添加)中增加如下代碼,
并將return的返回值改為TRUE
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
m_wndSplitter.CreateStatic(this, 1, 2);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CPEReaderView), CSize(100, 100), pContext);
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CPEReaderView), CSize(100, 100), pContext); return
TRUE;
}
同時需要在MainFrm.cpp中增加所加視圖的頭文件包括
#include "PEReaderView.h"4.如果編譯時出現文檔類的missing storage-class or type specifiers 錯誤,
請在視圖類的頭文件中包含文檔類的頭文件
#include "PEReaderDoc.h"于是一個最簡單的切分視圖就創建完成了,切分的兩個視圖基于相同的視圖類