Code
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
protected:
CSplitterWnd m_wndSplitter;
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
protected:
CSplitterWnd m_wndSplitter;
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
public:
virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext);
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
Code
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 3));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDoubleView), //第一个视图
CSize(200, 200), pContext));
VERIFY(m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CDoubleView), //第二个视图
CSize(200, 200), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(0, 2, RUNTIME_CLASS(CDoubleView), //第三个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CDoubleView), //第一个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 1, RUNTIME_CLASS(CDoubleView), //第二个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 2, RUNTIME_CLASS(CDoubleView), //第三个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
return TRUE;
}
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 3));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CDoubleView), //第一个视图
CSize(200, 200), pContext));
VERIFY(m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CDoubleView), //第二个视图
CSize(200, 200), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(0, 2, RUNTIME_CLASS(CDoubleView), //第三个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CDoubleView), //第一个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 1, RUNTIME_CLASS(CDoubleView), //第二个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
VERIFY(m_wndSplitter.CreateView(1, 2, RUNTIME_CLASS(CDoubleView), //第三个视图
CSize(300, 300), pContext)); //也可以设定不同的视图类
return TRUE;
}