15,979
社区成员
发帖
与我相关
我的任务
分享
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
CRect rect;
GetClientRect(&rect);
if (!m_wndSplitter.CreateStatic(this,1,3))
return FALSE;
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CFireView),CSize(rect.Width()*20/45,rect.Height()),pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
if (!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CFireView),CSize(rect.Width()*20/45,rect.Height()),pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
if (!m_wndSplitter.CreateView(0,2,RUNTIME_CLASS(CFireView),CSize(rect.Width()/3,rect.Height()),pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
//return CFrameWnd::OnCreateClient(lpcs, pContext);
}
int CFireView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFormView::OnCreate(lpCreateStruct) == -1)
return -1;
if (!theApp.pMain[theApp.m_theview] && theApp.m_theview < VIEWNUM)
{
theApp.pMain[theApp.m_theview] = new CMainAction() ;
theApp.pMain[theApp.m_theview]->Create(IDD_MAINACTION ,this) ;
theApp.pMain[theApp.m_theview]->ShowWindow(SW_SHOW) ;
theApp.pRight[theApp.m_theview] = new CRightView() ;
theApp.pRight[theApp.m_theview]->Create(IDD_RIGHTVIEW ,this) ;
theApp.pRight[theApp.m_theview]->ShowWindow(SW_SHOW) ;
}
// TODO: Add your specialized creation code here
return 0;
}
void CFireView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
CRect rect ,rect1 ,rect2 ;
GetClientRect(&rect) ;
if (theApp.m_theview >= 3)
{
theApp.m_theview = 0 ;
}
//左边窗口位置设定
rect1 = rect ;
rect1.right = rect1.left + 420 ;
theApp.pMain[theApp.m_theview]->MoveWindow(rect1) ;
//右边窗口位置设定
rect2 = rect1 ;
rect2.left = rect1.right ;
rect2.right = rect2.left + 355 ;
theApp.pRight[theApp.m_theview]->MoveWindow(rect2) ;
++ theApp.m_theview ;//在运行这里第二次之后就会出现错误