網上的很多**和部落格都是單文件的分隔視窗。我這裡是多文件下分隔視窗的**。
bool cchildframe::
oncreateclient
(lpcreatestruct lpcs, ccreatecontext* pcontext)
// 建立左邊窗格中的檢視 if(
!m_wndsplitter.
createview(0
,0,runtime_class
(cmytreeview2)
,csize
(rc.
width()
/5, rc.
height()
), pcontext)
)return false;
//接下來是要把右邊的視窗再分成兩份。2行1列。最後乙個引數的意思是在原先分隔好的視窗中
//右邊的視窗中進行分隔,因為右邊的是0行1列,因為計算機都是從0開始。if(
!m_wndsplitter2.
createstatic
(&m_wndsplitter,2,
1, ws_child | ws_visible, m_wndsplitter.
idfromrowcol(0
,1))
)//下面的**就是對右邊的新分出來的兩個視窗進行設定。if(
!m_wndsplitter2.
createview(0
,0,runtime_class
(choleinfodisplay)
,csize
(rc.
width()
*0.8
, rc.
height()
*0.3
), pcontext)
)return false;if(
!m_wndsplitter2.
createview(1
,0,runtime_class
,csize
(rc.
width()
*0.8
, rc.
height()
*0.7
), pcontext)
)return false;
return true;
//return cmdichildwnd::oncreateclient(lpcs, pcontext);
}
1.多文件的分隔視窗在cchildframe類裡面。不在那個cmainframe裡面。
2.具體的分割視窗的函式和引數的設定看我的**,有很多的注釋。就是一些引數的設定。基本的套路就是這樣。
MFC多文件框架
m viewlist.addtail pview assert pview m pdocument null must be un attached pview m pdocument this 獲得cmainframe 獲得 cchildframe 獲得cdocument 獲得cview afxg...
MFC多文件框架
m viewlist.addtail pview assert pview m pdocument null must be un attached pview m pdocument this 獲得cmainframe 獲得 cchildframe 獲得cdocument 獲得cview afxg...
MFC多文件框架
m viewlist.addtail pview assert pview m pdocument null must be un attached pview m pdocument this 獲得cmainframe 獲得 cchildframe 獲得cdocument 獲得cview afxg...