SDI中的窗口切分

系统 1897 0
一、主要函数
(1)CSplitterWnd::CreateStatic

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

pParentWnd

The parent frame window of the splitter window.

nRows

The number of rows. This value must not exceed 16.

nCols

The number of columns. This value must not exceed 16.

dwStyle

Specifies the window style.

nID

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

row

Specifies the splitter window row in which to place the newview.

col

Specifies the splitter window column in which to place the newview.

pViewClass

Specifies the CRuntimeClass of the new view.

sizeInit

Specifies the initial size of the new view.

pContext

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).

ReturnValue

Nonzero if successful; otherwise 0.

Remarks

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.

Example
                  
                    二、(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);}
                  

SDI中的窗口切分


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论