*** 切分窗口中的问题 ***
BOOL XXXX::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter1.CreateStatic(this, 1, 2))
{
return FALSE;
}
if (!m_wndSplitter1.CreateView(0, 0, RUNTIME_CLASS(CGameView), CSize(500, 0), pContext) )
{
m_wndSplitter1.DestroyWindow();
return FALSE;
}
if (!m_wndSplitter2.CreateStatic(&m_wndSplitter1, 2, 1,WS_CHILD|WS_VISIBLE,m_wndSplitter1.IdFromRowCol(0, 1)))
{
return FALSE;
}
if (!m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CClientView), CSize(600, 300), pContext) ||
!m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CSysMsgView), CSize(600, 0), pContext))
{
m_wndSplitter2.DestroyWindow();
return FALSE;
}
return CFrameWnd::OnCreateClient(lpcs, pContext);
}
_______________
| |
| |
|_______|
| |
| |
______|_______|
最后我要得到右下角的视图:
CWnd* pWnd = m_wndSplitter2.GetPane(1, 0);
CXXXXView* pView = DYNAMIC_DOWNCAST(CXXXXView, pWnd);
return pView;
这样为什么会出错呢??
我调到
CWnd* CSplitterWnd::GetPane(int row, int col) const
{
ASSERT_VALID(this); <--------------出错XXXXXXXXXXXXXXXXXXXXX
CWnd* pView = GetDlgItem(IdFromRowCol(row, col));
ASSERT(pView != NULL); // panes can be a CWnd, but are usually CViews
return pView;
}