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繪制與文檔對(duì)象和邊框窗口對(duì)象相聯(lián)系的視區(qū)。
(2)在單個(gè)視類的切分窗口中,各個(gè)視區(qū)的內(nèi)容是完全一致的,只要一個(gè)視類對(duì)象
(3)切分窗口為多視類則,不同的切分窗口可以顯示不同的內(nèi)容,因此要?jiǎng)?chuàng)建多個(gè)視類對(duì)象。
三、代碼:
(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);}
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
