vc切割子窗口(CSplitterWnd)

*********

函数功能:切割子窗口

主要函数:CSplitterWnd

运行平台:Window XP SP1

编译环境:VC++ 6.0

*********

函数定义:CSplitter m_wndSplitter1;

                    CSplitter m_wndSplitter2;

                    CRightWnd,CLeftWnd1,CLeftWnd2 是基于CScrollView的类

                    CDialogView是基于CFormView的类;

                    以下代码覆盖CMainFrame的OnCreateClient函数

***************

BOOL isSplitterWnd = m_wndSplitter1.CreateStatic(this,0,1,WS_CHILD|WS_VISIBLE);
 m_wndSplitter1.CreateView(0,1,RUNTIME_CLASS(CRightWnd),CSize(50,500),pContext);
    m_wndSplitter2.CreateStatic(&m_wndSplitter1,3,1,WS_CHILD|WS_VISIBLE, m_wndSplitter1.IdFromRowCol(0, 0)); 
 m_wndSplitter2.CreateView(0,0,RUNTIME_CLASS(CLeftWnd1),CSize(500,50),pContext);
 m_wndSplitter2.CreateView(1,0,RUNTIME_CLASS(CLeftWnd2),CSize(500,50),pContext);
 m_wndSplitter2.CreateView(2,0,RUNTIME_CLASS(CDialogView),CSize(500,50),pContext);
 m_wndSplitter2.SetActivePane(2,0);
 CRect tempRect;
 GetWindowRect(tempRect);
 int wnd1Width = tempRect.right - tempRect.left;
 int wnd2Height1 = tempRect.bottom - tempRect.top;
 m_wndSplitter1.SetColumnInfo(0,5*wnd1Width/6,50);
 m_wndSplitter2.SetRowInfo(0,2*wnd2Height1/5,50);
 m_wndSplitter2.SetRowInfo(1,wnd2Height1/4,50);
 return (isSplitterWnd);

你可能感兴趣的:(vc切割子窗口(CSplitterWnd))