Esempio n. 1
0
        private void BuildGroupAreas()
        {
            switch (InsertType)
            {
            case DockInsertType.None:
                var dropRect = new Rectangle {
                    X      = DockGroup?.PointToScreen(Point.Empty).X ?? 0,
                    Y      = DockGroup?.PointToScreen(Point.Empty).Y ?? 0,
                    Width  = DockGroup?.Width ?? 0,
                    Height = DockGroup?.Height ?? 0
                };

                DropArea      = dropRect;
                HighlightArea = dropRect;

                break;

            case DockInsertType.Before:
                var beforeDropWidth  = DockGroup?.Width ?? 0;
                var beforeDropHeight = DockGroup?.Height ?? 0;

                switch (DockGroup?.DockArea)
                {
                case DarkDockArea.Left:
                case DarkDockArea.Right:
                    beforeDropHeight = DockGroup.Height / 4;
                    break;

                case DarkDockArea.Bottom:
                    beforeDropWidth = DockGroup.Width / 4;
                    break;
                }

                var beforeDropRect = new Rectangle {
                    X      = DockGroup?.PointToScreen(Point.Empty).X ?? 0,
                    Y      = DockGroup?.PointToScreen(Point.Empty).Y ?? 0,
                    Width  = beforeDropWidth,
                    Height = beforeDropHeight
                };

                DropArea      = beforeDropRect;
                HighlightArea = beforeDropRect;

                break;

            case DockInsertType.After:
                var afterDropX      = DockGroup?.PointToScreen(Point.Empty).X ?? 0;
                var afterDropY      = DockGroup?.PointToScreen(Point.Empty).Y ?? 0;
                var afterDropWidth  = DockGroup?.Width ?? 0;
                var afterDropHeight = DockGroup?.Height ?? 0;

                switch (DockGroup?.DockArea)
                {
                case DarkDockArea.Left:
                case DarkDockArea.Right:
                    afterDropHeight = DockGroup.Height / 4;
                    afterDropY      = DockGroup.PointToScreen(Point.Empty).Y + DockGroup.Height - afterDropHeight;
                    break;

                case DarkDockArea.Bottom:
                    afterDropWidth = DockGroup.Width / 4;
                    afterDropX     = DockGroup.PointToScreen(Point.Empty).X + DockGroup.Width - afterDropWidth;
                    break;
                }

                var afterDropRect = new Rectangle {
                    X      = afterDropX,
                    Y      = afterDropY,
                    Width  = afterDropWidth,
                    Height = afterDropHeight
                };

                DropArea      = afterDropRect;
                HighlightArea = afterDropRect;

                break;
            }
        }
Esempio n. 2
0
        private void BuildGroupAreas()
        {
            switch (InsertType)
            {
            case DockInsertType.None:
                var dropRect = new Rectangle
                {
                    X      = DockGroup.PointToScreen(Point.Empty).X,
                    Y      = DockGroup.PointToScreen(Point.Empty).Y,
                    Width  = DockGroup.Width,
                    Height = DockGroup.Height
                };

                DropArea      = dropRect;
                HighlightArea = dropRect;

                break;

            case DockInsertType.Before:
                var beforeDropWidth  = DockGroup.Width;
                var beforeDropHeight = DockGroup.Height;

                switch (DockGroup.DockArea)
                {
                case DarkDockArea.Left:
                case DarkDockArea.Right:
                    beforeDropHeight = DockGroup.Height / 4;
                    break;

                case DarkDockArea.Bottom:
                    beforeDropWidth = DockGroup.Width / 4;
                    break;
                }

                var beforeDropRect = new Rectangle
                {
                    X      = DockGroup.PointToScreen(Point.Empty).X,
                    Y      = DockGroup.PointToScreen(Point.Empty).Y,
                    Width  = beforeDropWidth,
                    Height = beforeDropHeight
                };

                DropArea      = beforeDropRect;
                HighlightArea = beforeDropRect;

                break;

            case DockInsertType.After:
                var afterDropX      = DockGroup.PointToScreen(Point.Empty).X;
                var afterDropY      = DockGroup.PointToScreen(Point.Empty).Y;
                var afterDropWidth  = DockGroup.Width;
                var afterDropHeight = DockGroup.Height;

                switch (DockGroup.DockArea)
                {
                case DarkDockArea.Left:
                case DarkDockArea.Right:
                    afterDropHeight = DockGroup.Height / 4;
                    afterDropY      = DockGroup.PointToScreen(Point.Empty).Y + DockGroup.Height - afterDropHeight;
                    break;

                case DarkDockArea.Bottom:
                    afterDropWidth = DockGroup.Width / 4;
                    afterDropX     = DockGroup.PointToScreen(Point.Empty).X + DockGroup.Width - afterDropWidth;
                    break;
                }

                var afterDropRect = new Rectangle
                {
                    X      = afterDropX,
                    Y      = afterDropY,
                    Width  = afterDropWidth,
                    Height = afterDropHeight
                };

                DropArea      = afterDropRect;
                HighlightArea = afterDropRect;

                break;
            }

            Debug.Assert(DockPanel.ParentForm != null, "DockPanel.ParentForm != null");
            DropArea      = Rectangle.Intersect(DropArea, DockPanel.ParentForm.Bounds);
            HighlightArea = Rectangle.Intersect(HighlightArea, DockPanel.ParentForm.Bounds);
        }
Esempio n. 3
0
        private void BuildGroupAreas()
        {
            switch (InsertType)
            {
            case DockInsertType.None:
                Rectangle dropRect = new()
                {
                    X      = DockGroup.PointToScreen(Point.Empty).X,
                    Y      = DockGroup.PointToScreen(Point.Empty).Y,
                    Width  = DockGroup.Width,
                    Height = DockGroup.Height
                };

                DropArea      = dropRect;
                HighlightArea = dropRect;

                break;

            case DockInsertType.Before:
                int beforeDropWidth  = DockGroup.Width;
                int beforeDropHeight = DockGroup.Height;

                switch (DockGroup.DockArea)
                {
                case DockArea.Left:
                case DockArea.Right:
                    beforeDropHeight = DockGroup.Height / 4;
                    break;

                case DockArea.Bottom:
                    beforeDropWidth = DockGroup.Width / 4;
                    break;
                }

                Rectangle beforeDropRect = new()
                {
                    X      = DockGroup.PointToScreen(Point.Empty).X,
                    Y      = DockGroup.PointToScreen(Point.Empty).Y,
                    Width  = beforeDropWidth,
                    Height = beforeDropHeight
                };

                DropArea      = beforeDropRect;
                HighlightArea = beforeDropRect;

                break;

            case DockInsertType.After:
                int afterDropX      = DockGroup.PointToScreen(Point.Empty).X;
                int afterDropY      = DockGroup.PointToScreen(Point.Empty).Y;
                int afterDropWidth  = DockGroup.Width;
                int afterDropHeight = DockGroup.Height;

                switch (DockGroup.DockArea)
                {
                case DockArea.Left:
                case DockArea.Right:
                    afterDropHeight = DockGroup.Height / 4;
                    afterDropY      = DockGroup.PointToScreen(Point.Empty).Y + DockGroup.Height - afterDropHeight;
                    break;

                case DockArea.Bottom:
                    afterDropWidth = DockGroup.Width / 4;
                    afterDropX     = DockGroup.PointToScreen(Point.Empty).X + DockGroup.Width - afterDropWidth;
                    break;
                }

                Rectangle afterDropRect = new()
                {
                    X      = afterDropX,
                    Y      = afterDropY,
                    Width  = afterDropWidth,
                    Height = afterDropHeight
                };

                DropArea      = afterDropRect;
                HighlightArea = afterDropRect;

                break;
            }
        }

        #endregion
    }