void ChangePanes(int nPaneStateNew) { // If starting, create panes and views if (m_viewTop == null && m_viewBottom == null) { // Bottom full size m_viewBottom = new LevelViewParent(); m_viewBottom.SetDocument(m_doc); m_viewBottom.Dock = DockStyle.Fill; Controls.Add(m_viewBottom); // Top m_viewTop = new LevelViewParent(); m_viewTop.SetDocument(m_doc); m_viewTop.Dock = DockStyle.Top; Controls.Add(m_viewTop); // Set right order for auto formatting Controls.SetChildIndex(m_viewBottom, 0); Controls.SetChildIndex(splitter, 1); Controls.SetChildIndex(m_viewTop, 2); // If state 2 then top pane is zero height if (nPaneStateNew == 2) { splitter.SplitPosition = 0; } return; } // If closing remove panes and views if (nPaneStateNew == 0) { m_viewTop.Dispose(); Controls.Remove(m_viewTop); m_viewTop = null; m_viewBottom.Dispose(); Controls.Remove(m_viewBottom); m_viewBottom = null; return; } // Have both panes. switch (nPaneStateNew) { case -2: // Expand the top pane: Make top pane the bottom pane, // then make top pane size 0 LevelViewParent viewT = m_viewTop; m_viewTop = m_viewBottom; m_viewBottom = viewT; // Set right order for auto formatting m_viewTop.Dock = DockStyle.Top; m_viewTop.Height = 0; m_viewBottom.Dock = DockStyle.Fill; splitter.SplitPosition = 0; Controls.SetChildIndex(m_viewBottom, 0); Controls.SetChildIndex(splitter, 1); Controls.SetChildIndex(m_viewTop, 2); break; case 2: // Expand the bottom pane: Make top pane 0 size splitter.SplitPosition = 0; break; case 3: // Expand the top pane splitter.SplitPosition = ClientSize.Height / 2; break; } }
void ChangePanes(int nPaneStateNew) { // If starting, create panes and views if (m_viewTop == null && m_viewBottom == null) { // Bottom full size m_viewBottom = new LevelViewParent(); m_viewBottom.SetDocument(m_doc); m_viewBottom.Dock = DockStyle.Fill; Controls.Add(m_viewBottom); // Top m_viewTop = new LevelViewParent(); m_viewTop.SetDocument(m_doc); m_viewTop.Dock = DockStyle.Top; Controls.Add(m_viewTop); // Set right order for auto formatting Controls.SetChildIndex(m_viewBottom, 0); Controls.SetChildIndex(splitter, 1); Controls.SetChildIndex(m_viewTop, 2); // If state 2 then top pane is zero height if (nPaneStateNew == 2) splitter.SplitPosition = 0; return; } // If closing remove panes and views if (nPaneStateNew == 0) { m_viewTop.Dispose(); Controls.Remove(m_viewTop); m_viewTop = null; m_viewBottom.Dispose(); Controls.Remove(m_viewBottom); m_viewBottom = null; return; } // Have both panes. switch (nPaneStateNew) { case -2: // Expand the top pane: Make top pane the bottom pane, // then make top pane size 0 LevelViewParent viewT = m_viewTop; m_viewTop = m_viewBottom; m_viewBottom = viewT; // Set right order for auto formatting m_viewTop.Dock = DockStyle.Top; m_viewTop.Height = 0; m_viewBottom.Dock = DockStyle.Fill; splitter.SplitPosition = 0; Controls.SetChildIndex(m_viewBottom, 0); Controls.SetChildIndex(splitter, 1); Controls.SetChildIndex(m_viewTop, 2); break; case 2: // Expand the bottom pane: Make top pane 0 size splitter.SplitPosition = 0; break; case 3: // Expand the top pane splitter.SplitPosition = ClientSize.Height / 2; break; } }