我想自己6级得水平没什么问题吧。
CMainFrame
As in EX20A, the EX20B application's main frame window class needs a splitter window data member and a prototype for an overridden OnCreateClient function. You can let AppWizard generate the code by specifying Use Split Window, as in EX20A. You won't have to modify the MainFrm.h file. The implementation file, MainFrm.cpp, needs both view class headers (and the prerequisite document header), as shown here:
#include "PoemDoc.h"
#include "StringView.h"
#include "HexView.h"
AppWizard generates dynamic splitter code in the OnCreateClient function, so you'll have to do some editing if you want a static splitter. Instead of calling CSplitterWnd::Create, you'll call the CSplitterWnd::CreateStatic function, which is tailored for multiple view classes. The following calls to CSplitterWnd::CreateView attach the two view classes. As the second and third CreateStatic parameters (2, 1) dictate, this splitter window contains only two panes. The horizontal split is initially 100 device units from the top of the window. The top pane is the string view; the bottom pane is the hex dump view. The user can change the splitter bar position but the view configuration cannot be changed.
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 1));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CStringView),
CSize(100, 100), pContext));
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CHexView),
CSize(100, 100), pContext));
return TRUE;
}
CMainFrame
As in EX20A, the EX20B application's main frame window class needs a splitter window data member and a prototype for an overridden OnCreateClient function. You can let AppWizard generate the code by specifying Use Split Window, as in EX20A. You won't have to modify the MainFrm.h file. The implementation file, MainFrm.cpp, needs both view class headers (and the prerequisite document header), as shown here:
#include "PoemDoc.h"
#include "StringView.h"
#include "HexView.h"
AppWizard generates dynamic splitter code in the OnCreateClient function, so you'll have to do some editing if you want a static splitter. Instead of calling CSplitterWnd::Create, you'll call the CSplitterWnd::CreateStatic function, which is tailored for multiple view classes. The following calls to CSplitterWnd::CreateView attach the two view classes. As the second and third CreateStatic parameters (2, 1) dictate, this splitter window contains only two panes. The horizontal split is initially 100 device units from the top of the window. The top pane is the string view; the bottom pane is the hex dump view. The user can change the splitter bar position but the view configuration cannot be changed.
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 1));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CStringView),
CSize(100, 100), pContext));
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CHexView),
CSize(100, 100), pContext));
return TRUE;
}
DECLARE_DYNAMIC(CTopViewt,CView);
DECLARE_DYNAMIC(CRandViewt,CView);
或
DECLARE_DYNCREATE(CTopViewt,CView);
DECLARE_DYNCREATE(CRandViewt,CView);
2.应该检查一下你的CTopViewt和CRandView执行本中有无定义
IMPLEMENT_DYNAMIC(CRandViewt,CView)
IMPLEMENT_DYNAMIC(CTopViewt,CView)
或
IMPLEMENT_DYNCREATE(CRandViewt,CView)
IMPLEMENT_DYNCREATE(CTopViewt,CView)
如果有就应该没问题。
生成时要指定Use Split Window
见者有份!!!我出手大方吧!!