CustomWidgets.EaseBox CreateTinyControlBox(SpaceName name) { int controllerBoxWH = 10; CustomWidgets.EaseBox tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = PixelFarm.Drawing.Color.Red; tinyBox.Tag = name; //add handler for each tiny box tinyBox.MouseDrag += (s, e) => { ResizeTargetWithSnapToGrid2((SpaceName)tinyBox.Tag, this, e, e.DiffCapturedX, e.DiffCapturedY); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; tinyBox.MouseUp += (s, e) => { if (e.IsDragging) { ResizeTargetWithSnapToGridWhenDragRelease(this, e); } //if (e.IsDragging) //{ // //var targetBox = this.TargetBox; // //var newRect = new Rectangle(targetBox.Left, targetBox.Top, targetBox.Width, targetBox.Height); // //this.DesignBoardModule.HistoryRecordDzElementNewBounds( // // targetBox, // // this.beginRect, // // newRect); // //this.beginRect = newRect; // //ResizeTargetWithSnapToGridWhenMouseUp(this, e); //} e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return(tinyBox); }
CustomWidgets.EaseBox CreateTinyControlBox(SpaceName name) { int controllerBoxWH = 10; CustomWidgets.EaseBox tinyBox = new CustomWidgets.SimpleBox(controllerBoxWH, controllerBoxWH); tinyBox.BackColor = PixelFarm.Drawing.Color.Red; tinyBox.Tag = name; //add handler for each tiny box tinyBox.MouseDrag += (s, e) => { ResizeTargetWithSnapToGrid2((SpaceName)tinyBox.Tag, this, e, e.DiffCapturedX, e.DiffCapturedY); e.MouseCursorStyle = MouseCursorStyle.Pointer; e.CancelBubbling = true; }; tinyBox.MouseUp += (s, e) => { if (e.IsDragging) { ResizeTargetWithSnapToGridWhenDragRelease(this, e); } //if (e.IsDragging) //{ // //var targetBox = this.TargetBox; // //var newRect = new Rectangle(targetBox.Left, targetBox.Top, targetBox.Width, targetBox.Height); // //this.DesignBoardModule.HistoryRecordDzElementNewBounds( // // targetBox, // // this.beginRect, // // newRect); // //this.beginRect = newRect; // //ResizeTargetWithSnapToGridWhenMouseUp(this, e); //} e.MouseCursorStyle = MouseCursorStyle.Default; e.CancelBubbling = true; }; return tinyBox; }