public void RemovePanel(MultiSplitPanel panel) { var index = Panels.IndexOf(panel); if (index >= 0) { SuspendLayout(); Panels.RemoveAt(index); Splits.RemoveAt(index); Controls.Remove(panel); if (Splits.Count > 0) { Splits[Splits.Count - 1] = FullSize; } AdjustPanels(); ResumeLayout(); } }
public MultiSplitPanel AddPanel(int index = -1) { SuspendLayout(); if (index < 0) { index = Panels.Count; } var addSize = FullSize / (Panels.Count + 1); ResizePanels(-addSize); Splits.Add(FullSize); var newPanel = new MultiSplitPanel(); newPanel.Height = Height; newPanel.Top = 0; Panels.Insert(index, newPanel); Controls.Add(newPanel); Fit(); AdjustPanels(); if (index == 0) { FirstPanel = newPanel; } if (index == 1) { SecondPanel = newPanel; } if (index == 2) { ThirdPanel = newPanel; } ResumeLayout(); return(newPanel); }