void DisposeHorizontalSplitContainer() { if (horizontalSplitContainer == null) { return; } if (listView != null && horizontalSplitContainer.Panel1.Controls.Contains(listView)) { horizontalSplitContainer.Panel1.Controls.Remove(listView); } if (textEditor != null && horizontalSplitContainer.Panel2.Controls.Contains(textEditorHost)) { horizontalSplitContainer.Panel2.Controls.Remove(textEditorHost); } if (verticalSplitContainer != null && verticalSplitContainer.Panel2.Controls.Contains(horizontalSplitContainer)) { verticalSplitContainer.Panel2.Controls.Remove(horizontalSplitContainer); } horizontalSplitContainer.Dispose(); horizontalSplitContainer = null; }
void DisposeVerticalSplitContainer() { if (verticalSplitContainer == null) { return; } if (horizontalSplitContainer != null && verticalSplitContainer.Panel2.Controls.Contains(horizontalSplitContainer)) { verticalSplitContainer.Panel2.Controls.Remove(horizontalSplitContainer); } if (listView != null && verticalSplitContainer.Panel2.Controls.Contains(listView)) { verticalSplitContainer.Panel2.Controls.Remove(listView); } if (treeView != null && verticalSplitContainer.Panel1.Controls.Contains(treeView)) { verticalSplitContainer.Panel1.Controls.Remove(treeView); } verticalSplitContainer.Dispose(); verticalSplitContainer = null; }
static public void Merge(this SplitContainer topsplitter, int panel) // currentsplitter has a splitter underneath it in panel (0/1) { SplitContainer insidesplitter = (SplitContainer)topsplitter.Controls[panel].Controls[0]; // get that split container, error if not. Control keep = insidesplitter.Panel1.Controls[0]; // we keep this control - the left/top one insidesplitter.Panel2.Controls[0].Dispose(); // and we dispose(close) the right/bot one insidesplitter.Panel1.Controls.Clear(); // clear the control list on the inside splitter so it does not kill the keep list insidesplitter.Dispose(); // get rid of the inside splitter topsplitter.Controls[panel].Controls.Add(keep); // add the keep list back onto the the top splitter panel. }
private void exitButton_Click(object sender, EventArgs e) { recipeSearchTab.Controls.Remove(fullRecipeSplit); fullRecipeSplit.Dispose(); recipeTabContainer.Visible = true; }
public Table Table(Table dp, int proc) { // MessageBox.Show(dp.ToString(), "Hmm"); // MessageBox.Show(Microsoft.VisualBasic.Information.TypeName(dp), "Hmm2"); try { // MessageBox.Show(dp[1, "WERKS"], "Wow!"); } catch (Exception ex) { MessageBox.Show("Exception caught:" + ex.GetType() + ex.Message + ex.ToString(), "EXCEPTION"); } plants.Clear(); listBox1.BeginUpdate(); listBox1.Items.Clear(); try { Hashtable hash = new Hashtable(); ControlCollection cc; SplitContainer splitContainer = null; cc = splitContainer1.Panel1.Controls; foreach (_CSAPTaFacRow row in dp.Rows) { string strp = ((string)row.get_Value("AUTH")); string strtyp = ((string)row.get_Value("VPTYP")); string strr = ((string)row.get_Value("ROUTE")).Substring(3, 3); string strd = ((string)row.get_Value("VCTEXT")).Substring(7); /* MultiSelListBox code */ listBox1.Items.Add(strr + ": " + strd); /* Shiny new dynamic listview code */ Plant p; if (!plants.ContainsKey(strp)) { splitContainer = new SplitContainer(); splitContainer.Dock = DockStyle.Fill; cc.Add(splitContainer); cc = splitContainer.Panel2.Controls; p = new Plant(); p.name = strp; //splitContainer.SplitterDistance = 200; p.panel = splitContainer.Panel1; p.listView = new RouteListView(); p.listView.auth = strp; p.listView.HideSelection = false; p.listView.Sorting = SortOrder.Ascending; p.listView.AllowDrop = true; p.listView.Columns.Add("Route"); p.listView.Columns.Add("Description"); p.listView.View = View.Details; p.listView.Dock = DockStyle.Fill; p.panel.Controls.Add(p.listView); plants[strp] = p; Label lbl = new Label(); lbl.Text = "Plant " + strp; lbl.Dock = DockStyle.Top; p.panel.Controls.Add(lbl); splitContainers.Add(splitContainer); } else { p = plants[strp]; } RouteListViewItem i = new RouteListViewItem(strr, strd, strtyp, strp); i.BackColor = Color.FromArgb(255, ((16 * p.listView.Items.Count) % 255), ((16 * p.listView.Items.Count) % 255)); p.listView.Add(i); } if (splitContainer != null) { Control parent = splitContainer.Parent; parent.Controls.Remove(splitContainer); splitContainers.Remove(splitContainer); for (int i = splitContainer.Panel1.Controls.Count; i > 0; i--) { Control control = splitContainer.Panel1.Controls[0]; control.Parent.Controls.Remove(control); parent.Controls.Add(control); } splitContainer.Dispose(); splitContainer = null; } } catch (Exception ex) { MessageBox.Show("Caught:" + ex.Message); } listBox1.EndUpdate(); dp.AppendRow(); dp.AppendRow(); this.Dock = DockStyle.Fill; //this.Padding = new Padding(0, 0, 16, 16); ControlCollection cc2; SplitContainer splitContainer2 = null; cc2 = splitContainer1.Panel2.Controls; for (int i = 0; i < proc; i++) { PackProcess pk = new PackProcess(); splitContainer2 = new SplitContainer(); splitContainer2.Dock = DockStyle.Fill; cc2.Add(splitContainer2); cc2 = splitContainer2.Panel2.Controls; pk.listView = new RouteListView(); pk.name = "Process " + (i + 1); pk.listView.Sorting = SortOrder.Ascending; pk.listView.Dock = DockStyle.Fill; pk.listView.View = View.Details; pk.listView.AllowDrop = true; pk.listView.Columns.Add("Route"); pk.listView.Columns.Add("Description").AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); splitContainer2.Panel1.Controls.Add(pk.listView); packProcesses[i] = pk; Label lbl = new Label(); lbl.Dock = DockStyle.Top; lbl.Text = pk.name; splitContainer2.Panel1.Controls.Add(lbl); } if (splitContainer2 != null) { Control parent = splitContainer2.Parent; parent.Controls.Remove(splitContainer2); splitContainers.Remove(splitContainer2); for (int i = splitContainer2.Panel1.Controls.Count; i > 0; i--) { Control control = splitContainer2.Panel1.Controls[0]; control.Parent.Controls.Remove(control); parent.Controls.Add(control); } splitContainer2.Dispose(); splitContainer2 = null; } foreach (KeyValuePair <string, Plant> kvp in plants) { kvp.Value.listView.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); } foreach (KeyValuePair <int, PackProcess> kvp in packProcesses) { kvp.Value.listView.Columns[1].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); } return(dp); }