複数のビューの表示の例(.h) |
・・・ CSplitterWnd m_splittWnd; ・・・ //{{AFX_VIRTUAL(CJpRegressionChildFrame) ・・・ virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ); ・・・ //}}AFX_VIRTUAL |
複数のビューの表示の例(.cpp) |
BOOL CHogeChildFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ){ BOOL result; //CSplitterWndオブジェクトの作成 result = m_splittWnd.CreateStatic( this, 2, 1); if(!result) return FALSE; CRect rect; GetClientRect(&rect); //上のビュー CSize size; size.cx = rect.Width(); size.cy = rect.Height() / 3 * 2; result = m_splittWnd.CreateView( 0, 0, RUNTIME_CLASS(CHogeView), size, pContext); if(!result) return FALSE; size.cy = rect.Height() / 3; result = m_splittWnd2.CreateView( 1, 0, RUNTIME_CLASS(CHogeView2), size, pContext); return TRUE; } |
HogeView | |
HogeView2 | HogeView3 |
スプリッタのネストの例(.h) |
・・・ CSplitterWnd m_splittWnd; CSplitterWnd m_splittWnd2; ・・・ //{{AFX_VIRTUAL(CJpRegressionChildFrame) ・・・ virtual BOOL OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ); ・・・ //}}AFX_VIRTUAL |
スプリッタのネストの例(.cpp) |
BOOL CHogeChildFrame::OnCreateClient( LPCREATESTRUCT lpcs, CCreateContext* pContext ){ BOOL result; //分割ビューを行う準備 result = m_splittWnd.CreateStatic( this, 2, 1); if(!result) return FALSE; result = m_splittWnd2.CreateStatic( &m_splittWnd, 1, 2, WS_CHILD | WS_VISIBLE | WS_BORDER, m_splittWnd.IdFromRowCol(1,0)); if(!result) return FALSE; CRect rect; GetClientRect(&rect); //上のビュー CSize size; size.cx = rect.Width(); size.cy = rect.Height() / 3 * 2; result = m_splittWnd.CreateView( 0, 0, RUNTIME_CLASS(CHogeView), size, pContext); if(!result) return FALSE; //ネストしたビュー size.cy = rect.Height() / 3; size.cx = rect.Width() / 3 *2; result = m_splittWnd2.CreateView( 0, 0, RUNTIME_CLASS(CHogeView2), size, pContext); if(!result) return FALSE; result = m_splittWnd2.CreateView( 0, 1, RUNTIME_CLASS(CHogeView3), size, pContext); return TRUE; } |