BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
BOOL bResult=m_wndSplitterV.CreateStatic(this,1,2);
ASSERT(bResult);
m_wndSplitterH.CreateStatic(&m_wndSplitterV,3,1,WS_CHILD | WS_VISIBLE,m_wndSplitterV.IdFromRowCol(0,1));
RECT clientRect;
GetClientRect(&clientRect);
int width=clientRect.right-clientRect.left;
int height=clientRect.bottom-clientRect.top;
m_wndSplitterV.CreateView(0,0,RUNTIME_CLASS(CClientView),CSize(g_ScreenX,g_ScreenY),pContext);
m_wndSplitterH.CreateView(0,0,RUNTIME_CLASS(CWebView),CSize(200,200),pContext);
m_wndSplitterH.CreateView(1,0,RUNTIME_CLASS(CWebView2),CSize(200,200),pContext);
m_wndSplitterH.CreateView(2,0,RUNTIME_CLASS(CWebView),CSize(200,200),pContext);
g_Viewhwnd=m_wndSplitterV.GetPane(0,0)->GetSafeHwnd();
g_pWnd=m_wndSplitterV.GetPane(0,0);
m_wndSplitterV.SetOwner(this);
// //设置窗格的初始化的大小
m_wndSplitterV.SetColumnInfo(0,width*3/4,10);
m_wndSplitterH.SetRowInfo(0,height/3,10);
m_wndSplitterH.SetRowInfo(1,height/3,10);
m_wndSplitterH.SetRowInfo(2,height/3,10);
//((CWebView*)m_wndSplitterH.GetPane(0,0));
//激活sceneview使得其可以接受命令消息
m_wndSplitterV.SetActivePane(0,0,g_pWnd);
m_bCreateSplitter = TRUE;
return bResult;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType,cx,cy);
if(m_bCreateSplitter)
{
m_wndSplitterV.SetColumnInfo(0,cx*3/4,10);
m_wndSplitterV.SetColumnInfo(1,cx*1/4,10);
m_wndSplitterV.SetRowInfo(0,cy,10);
m_wndSplitterH.SetRowInfo(0,cy/3,10);
m_wndSplitterH.SetRowInfo(1,cy/3,10);
m_wndSplitterH.SetRowInfo(2,cy/3,10);
m_wndSplitterH.RecalcLayout();
m_wndSplitterV.RecalcLayout();
::UpdateWindow(g_hwnd);
::SetFocus(g_Viewhwnd);
}
}