To create a static splitter window, call the CreateStatic member function.
virtual BOOL CreateStatic( CWnd* pParentWnd, int nRows, int nCols, DWORD dwStyle = WS_CHILD | WS_VISIBLE, UINT nID = AFX_IDW_PANE_FIRST );
Parameters
The parent frame window of the splitter window.
The number of rows. This value must not exceed 16.
The number of columns. This value must not exceed 16.
Specifies the window style.
The child window ID of the window. The ID can be AFX_IDW_PANE_FIRST unless the splitter window is nestedinside another splitter window.
(2)CSplitterWnd::CreateView
Creates the panes for a static splitter window.
virtual BOOL CreateView( int row, int col, CRuntimeClass* pViewClass, SIZE sizeInit, CCreateContext* pContext );
Parameters
Specifies the splitter window row in which to place the newview.
Specifies the splitter window column in which to place the newview.
Specifies the CRuntimeClass of the new view.
Specifies the initial size of the new view.
A pointer to a creation context used to create the view (usuallythe pContext passed into the parentframe's overridden CFrameWnd::OnCreateClient member function in which the splitter window is being created).
All panes of a static splitter window must be created before theframework displays the splitter.
The framework also calls this member function to create newpanes when the user of a dynamic splitter window splits a pane,row, or column.
二、(1)OnCreateClient绘制与文档对象和边框窗口对象相联系的视区。
(2)在单个视类的切分窗口中,各个视区的内容是完全一致的,只要一个视类对象
(3)切分窗口为多视类则,不同的切分窗口可以显示不同的内容,因此要创建多个视类对象。
三、代码:
(1)声明切分窗口(可能要)
CChildFrame类中加入 CSpliterWnd m_wndSplitter
(2)在OnCreateClient加入代码
// this function creates the panes for a static splitter windowBOOL CChildFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext){ BOOL bCreateSpltr = m_wndSplitter.CreateStatic( this, 2, 1); // COneView and CAnotherView are user-defined views derived from CMDIView m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(COneView), CSize(0,0), pContext); m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CAnotherView), CSize(0,0), pContext); return (bCreateSpltr);}