internal void AddUndockingPanels(StiDockingPanel dockingPanel) { UndockedPanels.Add(dockingPanel); Form = (dockingPanel.FloatingForm != null) ? dockingPanel.LastDockForm : dockingPanel.Parent as Form; }
private void OnClosedUndockingPanels(object sender, EventArgs e) { foreach (var panel in UndockedPanels) { var form = panel.Parent as Form; if (form != null) { form.Close(); form.Dispose(); } } UndockedPanels.Clear(); }
internal void RemoveUndockingPanels(StiDockingPanel dockingPanel) { UndockedPanels.Remove(dockingPanel); }
private void LoadNodes(XmlTextReader tr) { while (tr.Read()) { if (!tr.IsStartElement()) { return; } #region Panel if (tr.Name == "Panel") { controlIndex = -1; isFloating = tr.GetAttribute("Floating") == "True"; isClosing = tr.GetAttribute("Closing") == "True"; if (!isClosing) { width = int.Parse(tr.GetAttribute("Width")); height = int.Parse(tr.GetAttribute("Height")); selectedIndex = int.Parse(tr.GetAttribute("SelectedIndex")); if (!isFloating) { autoHide = tr.GetAttribute("AutoHide") == "True"; dockStyle = (DockStyle)Enum.Parse(typeof(DockStyle), tr.GetAttribute("Dock")); } else { left = int.Parse(tr.GetAttribute("Left")); top = int.Parse(tr.GetAttribute("Top")); } } this.floatingForm = null; } #endregion #region Guid if (tr.Name == "Guid") { controlIndex++; string guid = XmlConvert.DecodeName(tr.ReadElementString()); if (guidChecker[guid] == null) { guidChecker[guid] = guid; var control = GetDockingControl(guid); if (control != null) { var dockingPanel = control.Parent as StiDockingPanel; if (!isClosing) { #region !isFloating if (!isFloating) { if (control.Parent.Dock != dockStyle) { dockingPanel.DockControlToForm(control, ParentForm, dockStyle); dockingPanel = GetDockingPanel(dockStyle); if (dockingPanel.Controls.Count == 0) { UndockedPanels.Remove(dockingPanel); } } if (control.Parent.Controls.IndexOf(control) != controlIndex) { control.Parent.Controls.SetChildIndex(control, controlIndex); } if (!autoHide) { dockingPanel.Width = width; dockingPanel.Height = height; } else { dockingPanel.AutoHide = autoHide; dockingPanel.Collapsed = true; dockingPanel.CollapsedSize = new Size(width, height); } } #endregion #region isFloating else { if (floatingForm == null) { dockingPanel.UndockControl(control, new Rectangle(left, top, width, height), true, dockingPanel.Parent); floatingForm = ((StiDockingPanel)control.Parent).FloatingForm; floatingForm.Width = width; floatingForm.Height = height; if (dockingPanel.Controls.Count == 0) { UndockedPanels.Remove(dockingPanel); } } else { dockingPanel.DockControlToPanel((StiDockingPanel)floatingForm.Controls[0]); if (dockingPanel.Controls.Count == 0) { UndockedPanels.Remove(dockingPanel); } } } #endregion if (controlIndex == selectedIndex && ((StiDockingPanel)control.Parent).SelectedControl != control) { ((StiDockingPanel)control.Parent).SelectedControl = control; } } else { dockingPanel.DoClose(control); } } } } #endregion LoadNodes(tr); } }