1.在main source file (有_Module定义的那个cpp)中加入:
//add
#include <atlmisc.h>
#include <atlctrlx.h>
2.在MainFrm.h中加入:
#include <atlsplit.h>
3.在类CMainFrame中加入成员变量:
CHorSplitterWindow m_wndHorzSplit;
CSplitterWindow m_wndVertSplit;
4.在CMainFrame的OnCreate中:
const DWORD dwSplitStyle = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
const DWORD dwSplitExStyle = WS_EX_CLIENTEDGE;
m_wndHorzSplit.Create ( *this, rcDefault, NULL,
dwSplitStyle, dwSplitExStyle );
m_wndVertSplit.Create ( m_wndHorzSplit, rcDefault, NULL,
dwSplitStyle, dwSplitExStyle );
m_wndHorzSplit.SetSplitterPane ( SPLIT_PANE_BOTTOM, m_wndVertSplit );
m_view.Create(m_wndVertSplit, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, WS_EX_CLIENTEDGE);
m_hWndClient = m_wndHorzSplit;
UpdateLayout();
m_wndHorzSplit.SetSplitterPos(64);
m_wndVertSplit.SetSplitterPos(200);
m_wndVertSplit.SetSplitterPanes ( m_view, NULL );
备注:
(1)注意绿色的那行,需要将原来OnCreate里的m_hWndClient = m_view.Create(...)注释掉
(2)注意红色的部分,要改一下。