/// <summary> /// Add form to guider /// </summary> /// <param name="form">form to guide</param> /// <param name="allowedDock">allowed dock</param> /// <param name="formIdentifier">identifier of the form added</param> /// <returns>object that encapsulates relevant information for the guided form</returns> public DockableFormInfo Add(Form form, DockAllowed allowedDock, Guid formIdentifier) { if (GetFormInfo(form) != null) { throw new ArgumentException("Err"); } // Should set the border as None to prevent Microsoft bug in TextBox: // TextBox on Form with TopLevel = False and FormBorderStyle != None doesn't process Click event form.FormBorderStyle = FormBorderStyle.None; Rectangle bounds = form.Bounds; DockableFormInfo info = new DockableFormInfo(form, allowedDock, formIdentifier); info.ExplicitDisposing += OnInfoDisposing; info.SelectedChanged += OnFormSelectedChanged; info.ShowAutoPanel += OnShowFormAutoPanel; _dockableForms.Add(info); FormsTabbedView view = CreateFormsTabbedView(bounds.Size, null); view.Add(info); _layout.CreateFloatingContainer(view, bounds); return(info); }
/// <summary> /// Undock view /// </summary> /// <param name="view">view to undock</param> /// <param name="hintBounds">hint bounds</param> private void Undock(Form formToUndock, Rectangle hintBounds) { FormsTabbedView view = HierarchyUtility.GetTabbedView(formToUndock); if (view.Count == 1) { _layout.Undock(view, hintBounds); } else { DockableFormInfo info = GetFormInfo(formToUndock); FormsTabbedView newView = CreateFormsTabbedView(info.DockableForm.Size, null); newView.Add(info); _layout.CreateFloatingContainer(newView, hintBounds); } }