예제 #1
0
        /// <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, zAllowedDock 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);
        }
예제 #2
0
        /// <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);
            }
        }
예제 #3
0
        /// <summary>
        /// Move all the pages to given view
        /// </summary>
        /// <param name="view">view where to move the pages</param>
        /// <returns>moved pages</returns>
        public DockableFormInfo[] MovePagesTo(FormsTabbedView view)
        {
            List <DockableFormInfo> movedPages = new List <DockableFormInfo>();

            if (view == this)
            {
                return(movedPages.ToArray());
            }


            for (int index = _cachedInfos.Count - 1; index >= 0; index--)
            {
                DockableFormInfo info = _cachedInfos[index];
                Remove(info);
                view.Add(info);

                movedPages.Add(info);
            }

            return(movedPages.ToArray());
        }
예제 #4
0
        /// <summary>
        /// Move all the pages to given view
        /// </summary>
        /// <param name="view">view where to move the pages</param>
        /// <returns>moved pages</returns>
        public DockableFormInfo[] MovePagesTo(FormsTabbedView view)
        {
            List<DockableFormInfo> movedPages = new List<DockableFormInfo>();

             if (view == this)
             {
            return movedPages.ToArray();
             }

             for (int index = _cachedInfos.Count - 1; index >= 0; index--)
             {
            DockableFormInfo info = _cachedInfos[index];
            Remove(info);
            view.Add(info);

            movedPages.Add(info);
             }

             return movedPages.ToArray();
        }