示例#1
0
        private void gripperMouseMove(object sender, MouseEventArgs e)
        {
            Point mouseLocation = MouseHelper.FixMouseCoordinates(e);

            if (Status.Equals(EditStatus.RESIZING))
            {
                // check if we already made this undoable
                if (!isMadeUndoable)
                {
                    // don't allow another undo until we are finished with this move
                    isMadeUndoable = true;
                    // Make undo-able
                    MakeBoundsChangeUndoable(false);
                }
                Invalidate();
                SuspendLayout();
                Label gr           = (Label)sender;
                int   gripperIndex = Int16.Parse(gr.Name.Substring(7));
                if (gripperIndex <= 2)                   // top row
                {
                    this.Top    += mouseLocation.Y - my;
                    this.Height -= mouseLocation.Y - my;
                }
                else if (gripperIndex >= 4 && gripperIndex <= 6)                     // bottom row
                {
                    this.Height += mouseLocation.Y - my;
                }
                if (gripperIndex >= 2 && gripperIndex <= 4)                  // right row
                {
                    this.Width += mouseLocation.X - mx;
                }
                else if (gripperIndex >= 6 || gripperIndex == 0)                    // left row
                {
                    this.Left  += mouseLocation.X - mx;
                    this.Width -= mouseLocation.X - mx;
                }
                ResumeLayout();
                Invalidate();
            }
        }
示例#2
0
        private void gripperMouseMove(object sender, MouseEventArgs e)
        {
            if (Status.Equals(EditStatus.RESIZING))
            {
                // check if we already made this undoable
                if (!isMadeUndoable)
                {
                    // don't allow another undo until we are finished with this move
                    isMadeUndoable = true;
                    // Make undo-able
                    MakeBoundsChangeUndoable(false);
                }

                Invalidate();
                SuspendLayout();

                Gripper gr   = (Gripper)sender;
                int     absX = gr.Left + e.X;
                int     absY = gr.Top + e.Y;

                // reset "workbench" rectangle to current bounds
                boundsAfterResize.X      = boundsBeforeResize.X;
                boundsAfterResize.Y      = boundsBeforeResize.Y;
                boundsAfterResize.Width  = boundsBeforeResize.Width;
                boundsAfterResize.Height = boundsBeforeResize.Height;

                // calculate scaled rectangle
                ScaleHelper.Scale(ref boundsAfterResize, gr.Position, new PointF(absX, absY), ScaleHelper.GetScaleOptions());

                // apply scaled bounds to this DrawableContainer
                ApplyBounds(boundsAfterResize);

                ResumeLayout();
                Invalidate();
            }
        }