Exemple #1
0
        /// <summary>
        /// Hide auto pane when mouse exits
        /// </summary>
        public void HideAutoPaneWhenMouseExits()
        {
            Point mousePosition = Control.MousePosition;


            bool checkIfShouldHideAutoPane = false;
            bool checkIfShouldHidePreview  = _previewPane.Visible;

            if (checkIfShouldHidePreview)
            {
                checkIfShouldHidePreview = (_host.RectangleToScreen(_previewPane.Bounds).Contains(mousePosition) == false);
            }

            AutoHidePanel panel = _autoShowPanel;

            if (panel != null)
            {
                if (panel.Visible)
                {
                    checkIfShouldHideAutoPane = (panel.RectangleToScreen(panel.ClientRectangle).Contains(mousePosition) == false);
                }
                else
                {
                    _autoShowPanel = null;
                }
            }

            if (checkIfShouldHideAutoPane || checkIfShouldHidePreview)
            {
                Point clientPosition = _host.PointToClient(mousePosition);

                if (IsPointInSpacers(clientPosition))
                {
                    return;
                }

                if (checkIfShouldHideAutoPane)
                {
                    _autoHidePanel            = panel;
                    _animationCommand.Handler = panel.AutoHideHandler;
                }

                if (checkIfShouldHidePreview)
                {
                    _previewPane.Visible = false;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// GEt fill screen rectangle
        /// </summary>
        /// <param name="wrapper">wrapper</param>
        /// <returns></returns>
        public static Rectangle GetFillScreenRectangle(FormWrapper wrapper)
        {
            Rectangle clientArea = wrapper.RectangleToClient(GetScreenClientRectangle(wrapper._host));

            int x1 = clientArea.Left;
            int x2 = clientArea.Right;
            int y1 = clientArea.Top;
            int y2 = clientArea.Bottom;

            for (int index = 0; index < wrapper.ControlsCount; index++)
            {
                Control control = wrapper.GetControlAt(index);
                if (control.Dock == DockStyle.None || control.Visible == false)
                {
                    continue;
                }

                if (control.Dock == DockStyle.Left)
                {
                    x1 = Math.Max(x1, control.Right);
                }
                else if (control.Dock == DockStyle.Right)
                {
                    x2 = Math.Min(x2, control.Left);
                }
                else if (control.Dock == DockStyle.Top)
                {
                    y1 = Math.Max(y1, control.Bottom);
                }
                else if (control.Dock == DockStyle.Bottom)
                {
                    y2 = Math.Min(y2, control.Top);
                }
            }

            if (x2 <= x1 || y2 <= y1)
            {
                return(new Rectangle());
            }

            Rectangle result = new Rectangle(x1, y1, x2 - x1, y2 - y1);

            return(wrapper.RectangleToScreen(result));
        }