Ejemplo n.º 1
0
        /// <summary>
        /// Stoped resise.
        /// </summary>
        public static void StopResize(bool cancel)
        {
            if (!cancel)
            {
                Rectangle rect = ResizeControl.Bounds;

                switch (dockingPanel.Dock)
                {
                case DockStyle.Left:
                    dockingPanel.Width += rect.Left - startResizeRectangle.Left;
                    break;

                case DockStyle.Right:
                    dockingPanel.Width -= rect.Left - startResizeRectangle.Left;
                    break;

                case DockStyle.Top:
                    dockingPanel.Height += rect.Top - startResizeRectangle.Top;
                    break;

                case DockStyle.Bottom:
                    dockingPanel.Height -= rect.Top - startResizeRectangle.Top;
                    break;
                }
            }

            dockingPanel.Parent.Controls.Remove(ResizeControl);

            ResizeControl.Dispose();
            ResizeControl           = null;
            dockingPanel.IsResizing = false;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Start resize Docking.
        /// </summary>
        public static void StartResize(StiDockingPanel panel, Rectangle rect, int minimumSize, int maximumSize)
        {
            minSize = minimumSize;
            maxSize = maximumSize;

            dockingPanel         = panel;
            startResizeRectangle = lastResizeRectangle = rect;
            if (ResizeControl != null)
            {
                ResizeControl.Dispose();
                ResizeControl = null;
            }
            ResizeControl        = new StiControlResize();
            ResizeControl.Bounds = rect;
            dockingPanel.Parent.Controls.Add(ResizeControl);
            dockingPanel.Parent.Controls.SetChildIndex(ResizeControl, 0);
            dockingPanel.IsResizing = true;
            lastResizePos           = Cursor.Position;
        }