예제 #1
0
        private Rectangle GetWindowSplitterDragRectangle()
        {
            DockState     state;
            DockContainer dockPanel;

            DockWindow     dockWindow     = DragControl as DockWindow;
            AutoHideWindow autoHideWindow = DragControl as AutoHideWindow;

            if (dockWindow != null)
            {
                state     = dockWindow.DockState;
                dockPanel = dockWindow.DockPanel;
            }
            else if (autoHideWindow != null)
            {
                state     = autoHideWindow.DockState;
                dockPanel = autoHideWindow.DockPanel;
            }
            else
            {
                return(Rectangle.Empty);
            }

            Rectangle rectLimit = dockPanel.DockArea;
            Point     location;

            if ((Control.ModifierKeys & Keys.Shift) == 0)
            {
                location = dockPanel.PointToClient(DragControl.Parent.PointToScreen(DragControl.Location));
            }
            else
            {
                location = dockPanel.DockArea.Location;
            }
            bool bVerticalSplitter;

            if (state == DockState.DockLeft || state == DockState.DockRight || state == DockState.DockLeftAutoHide || state == DockState.DockRightAutoHide)
            {
                rectLimit.X     += MeasurePane.MinSize;
                rectLimit.Width -= 2 * MeasurePane.MinSize;
                rectLimit.Y      = location.Y;
                if ((Control.ModifierKeys & Keys.Shift) == 0)
                {
                    rectLimit.Height = DragControl.Height;
                }
                bVerticalSplitter = true;
            }
            else
            {
                rectLimit.Y      += MeasurePane.MinSize;
                rectLimit.Height -= 2 * MeasurePane.MinSize;
                rectLimit.X       = location.X;
                if ((Control.ModifierKeys & Keys.Shift) == 0)
                {
                    rectLimit.Width = DragControl.Width;
                }
                bVerticalSplitter = false;
            }

            rectLimit.Location = dockPanel.PointToScreen(rectLimit.Location);

            return(GetSplitterDragRectangle(rectLimit, bVerticalSplitter));
        }