在主框架里把窗口拆分为3行1列:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
CRect rect;
GetClientRect(&rect);
if (!m_wndSplitter.CreateStatic(this,3,1))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(ServerMainView),CSize(rect.Width(),rect.Height()/3),pContext))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(ChartMainView),CSize(rect.Width(),rect.Height()/3+60),pContext))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(LineShowView),CSize(rect.Width(),rect.Height()/3-60),pContext))
{
return FALSE;
}
return TRUE;
}
在ServerMainView里把窗口拆分成左右两列:
int ServerMainView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1; // TODO: 在此添加您专用的创建代码
CRect rect;
GetClientRect(&rect);
CCreateContext *pContext = (CCreateContext *)lpCreateStruct->lpCreateParams;
if (!m_wndSplitter.CreateStatic(this,1,2))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(ServerView),CSize(rect.Width()/3*2,rect.Height()),pContext))
{
return FALSE;
}
if (m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(TestView),CSize(rect.Width()/3,rect.Height()),pContext))
{
return FALSE;
} return 0;
}
在CMainFrame里调用如下代码时报错:
ServerMainView * pWnd = (ServerMainView *)m_wndSplitter.GetPane(0, 0);
ServerView *serverWnd = (ServerView *)pWnd->m_wndSplitter.GetPane(0,0);
错误断言:
ASSERT(pMap != NULL);一直不知道问题在哪里,求各位高人指点
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
CRect rect;
GetClientRect(&rect);
if (!m_wndSplitter.CreateStatic(this,3,1))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(ServerMainView),CSize(rect.Width(),rect.Height()/3),pContext))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(ChartMainView),CSize(rect.Width(),rect.Height()/3+60),pContext))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(2,0,RUNTIME_CLASS(LineShowView),CSize(rect.Width(),rect.Height()/3-60),pContext))
{
return FALSE;
}
return TRUE;
}
在ServerMainView里把窗口拆分成左右两列:
int ServerMainView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1; // TODO: 在此添加您专用的创建代码
CRect rect;
GetClientRect(&rect);
CCreateContext *pContext = (CCreateContext *)lpCreateStruct->lpCreateParams;
if (!m_wndSplitter.CreateStatic(this,1,2))
{
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(ServerView),CSize(rect.Width()/3*2,rect.Height()),pContext))
{
return FALSE;
}
if (m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(TestView),CSize(rect.Width()/3,rect.Height()),pContext))
{
return FALSE;
} return 0;
}
在CMainFrame里调用如下代码时报错:
ServerMainView * pWnd = (ServerMainView *)m_wndSplitter.GetPane(0, 0);
ServerView *serverWnd = (ServerView *)pWnd->m_wndSplitter.GetPane(0,0);
错误断言:
ASSERT(pMap != NULL);一直不知道问题在哪里,求各位高人指点
以前也碰过
if (!m_wndSplitterH1.CreateStatic(this, 2, 1))
{
return FALSE;
}
CRect rc;
GetClientRect(&rc); m_wndSplitterH1.CreateView(1, 0, RUNTIME_CLASS(CMyView), CSize(100, 100), pContext);
//创建第个二静态拆分窗口,1行2列
if(!m_wndSplitterV.CreateStatic(&m_wndSplitterH1, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitterH1.IdFromRowCol(0, 0)))
{
return FALSE;
}
//创建第三个静态拆分窗口,2行1列
if (!m_wndSplitterH2.CreateStatic(&m_wndSplitterV, 2, 1, WS_CHILD | WS_VISIBLE, m_wndSplitterV.IdFromRowCol(0, 0)))
{
return FALSE;
} m_wndSplitterH2.CreateView(0, 0, RUNTIME_CLASS(CMyView2), CSize(100, rc.Height()/2), pContext);
m_wndSplitterH2.CreateView(1, 0, RUNTIME_CLASS(CMyView3), CSize(100, rc.Height()/2), pContext); //创建第四了静态拆分窗口,3行1列
if (!m_wndSplitterH3.CreateStatic(&m_wndSplitterV, 3, 1, WS_CHILD | WS_VISIBLE, m_wndSplitterV.IdFromRowCol(0, 1)))
{
return FALSE;
}
m_wndSplitterH3.CreateView(0, 0, RUNTIME_CLASS(CMyView4), CSize(100, 75), pContext);
m_wndSplitterH3.CreateView(1, 0, RUNTIME_CLASS(CMyView5), CSize(100, rc.Height()/3), pContext);
m_wndSplitterH3.CreateView(2, 0, RUNTIME_CLASS(CMyView1), CSize(100, rc.Height()/3), pContext);