-------1-------1
1 1 1
1 1 1
1 VIEW1 1 VIEW2 1
1 1 1
1 1 1
1--------------1
11
11
11 点击某按钮后
11
11
\/
-------1-------1
1 1 1
1 1 1
1 VIEW3 1 VIEW4 1
1 1 1
1 1 1
1--------------1我现在是用以下方法,但是效果不好
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftPaneFrame),CSize(500,200),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CRightPaneFrame),CSize(100,200),pContext);其中CLeftPaneFrame和CRightPaneFrame各自有VIEW1,VIEW3或者VIEW2,VIEW4,
要么激活VIEW1 VIEW2,要么激活VIEW3 VIEW4.
但是这样做后,在退出时总会有出错信息“First-chance exception in exe (MFC42D.DLL): 0xC0000005: Access Violation”。请高手指点,最好有代码,谢谢
1 1 1
1 1 1
1 VIEW1 1 VIEW2 1
1 1 1
1 1 1
1--------------1
11
11
11 点击某按钮后
11
11
\/
-------1-------1
1 1 1
1 1 1
1 VIEW3 1 VIEW4 1
1 1 1
1 1 1
1--------------1我现在是用以下方法,但是效果不好
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftPaneFrame),CSize(500,200),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CRightPaneFrame),CSize(100,200),pContext);其中CLeftPaneFrame和CRightPaneFrame各自有VIEW1,VIEW3或者VIEW2,VIEW4,
要么激活VIEW1 VIEW2,要么激活VIEW3 VIEW4.
但是这样做后,在退出时总会有出错信息“First-chance exception in exe (MFC42D.DLL): 0xC0000005: Access Violation”。请高手指点,最好有代码,谢谢
1. 从窗片中删除视A
2. 往窗片中添加视B 步骤1 的实现非常简单,仅用一条语句即可:
m_wndSplitter.DeleteView(0, 1);
但它是必不可少的,因为你不能让一个窗片同时包含两个视。我本来希望往一个窗片中添加新的视时,VC 会自动将原来的视删掉,可是它不干。 1.切分窗口 BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class if(wndSplitter.CreateStatic(this,1,2)==NULL)return FALSE;wndSplitter.CreateView(0,0,RUNTIME_CLASS(CView3),CSize(300,300),pContext); wndSplitter.CreateView(0,1,RUNTIME_CLASS(CView4),CSize(100,100),pContext); return TRUE; } 2。视图切换 void CMainFrame::SwitchToForm(CRuntimeClass *pRTClass) { wndSplitter.DeleteView0,1); //// 创建新的视 CCreateContext Context; Context.m_pNewViewClass=pRTClass;// // 视类 Context.m_pCurrentDoc = GetActiveDocument(); // 与文档连接 wndSplitter.CreateView(0,1, pRTClass,CSize(200,200),&Context); /* CView * pView = (CView *)wndSplitter.GetPane(0,1); // 获取分割区域 pView->ShowWindow(SW_SHOW); pView->OnInitialUpdate(); SetActiveView(pView); wndSplitter.SetRowInfo(0, 300, 20); // 设置宽度 ::SetWindowLong(pView->m_hWnd,GWL_ID, AFX_IDW_PANE_FIRST); */ wndSplitter.RecalcLayout();}
不过,隐藏一行怎么实现?能否提示一下?