protected override void OnMouseUp(MouseEventArgs e) { if ((this._mouseAction == MouseAction.None) || (this._image == null)) { base.OnMouseUp(e); } else { this.SuspendRedraw(); this._mouseAction = MouseAction.None; this._mousePreviousPos = Point.Empty; this._cropDragPoint = CropDragPoint.None; this.ResumeRedraw(); } }
protected override void OnMouseDown(MouseEventArgs e) { if ((this._penMode == Resco.Controls.ImageBox.PenMode.None) || (this._image == null)) { base.OnMouseDown(e); } else { if (this._penMode == Resco.Controls.ImageBox.PenMode.Move) { if ((this._visibleSize.Width < this._imageSize.Width) || (this._visibleSize.Height < this._imageSize.Height)) { this._mouseAction = MouseAction.MoveImage; } } else if (this._penMode == Resco.Controls.ImageBox.PenMode.Crop) { Rectangle cropBounds = this._drawArgs.CropBounds; if (Math.Abs((int) (cropBounds.Left - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Left; } else if (Math.Abs((int) (cropBounds.Right - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Right; } else if (Math.Abs((int) ((cropBounds.Left + (cropBounds.Width / 2)) - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Middle; } else { this._cropDragPoint = CropDragPoint.None; } if (this._cropDragPoint != CropDragPoint.None) { if (Math.Abs((int) (cropBounds.Top - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Top; } else if (Math.Abs((int) (cropBounds.Bottom - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Bottom; } else if (Math.Abs((int) ((cropBounds.Top + (cropBounds.Height / 2)) - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Middle; } else { this._cropDragPoint = CropDragPoint.None; } } if (((this._cropDragPoint == CropDragPoint.None) && (Math.Abs((int) ((cropBounds.Left + (cropBounds.Width / 2)) - e.X)) <= _cropRectSize)) && (Math.Abs((int) ((cropBounds.Top + (cropBounds.Height / 2)) - e.Y)) <= _cropRectSize)) { this._cropDragPoint = CropDragPoint.Middle; } if (this._cropDragPoint != CropDragPoint.None) { this._mouseAction = MouseAction.DragCrop; } else if ((this._visibleSize.Width < this._imageSize.Width) || (this._visibleSize.Height < this._imageSize.Height)) { this._mouseAction = MouseAction.MoveImage; } } if (this._mouseAction != MouseAction.None) { this._mousePreviousPos = new Point(e.X, e.Y); } } }
protected override void OnMouseDown(MouseEventArgs e) { if ((this._penMode == Resco.Controls.ImageBox.PenMode.None) || (this._image == null)) { base.OnMouseDown(e); } else { if (this._penMode == Resco.Controls.ImageBox.PenMode.Move) { if ((this._visibleSize.Width < this._imageSize.Width) || (this._visibleSize.Height < this._imageSize.Height)) { this._mouseAction = MouseAction.MoveImage; } } else if (this._penMode == Resco.Controls.ImageBox.PenMode.Crop) { Rectangle cropBounds = this._drawArgs.CropBounds; if (Math.Abs((int)(cropBounds.Left - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Left; } else if (Math.Abs((int)(cropBounds.Right - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Right; } else if (Math.Abs((int)((cropBounds.Left + (cropBounds.Width / 2)) - e.X)) <= _cropRectSize) { this._cropDragPoint = CropDragPoint.Middle; } else { this._cropDragPoint = CropDragPoint.None; } if (this._cropDragPoint != CropDragPoint.None) { if (Math.Abs((int)(cropBounds.Top - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Top; } else if (Math.Abs((int)(cropBounds.Bottom - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Bottom; } else if (Math.Abs((int)((cropBounds.Top + (cropBounds.Height / 2)) - e.Y)) <= _cropRectSize) { this._cropDragPoint |= CropDragPoint.Middle; } else { this._cropDragPoint = CropDragPoint.None; } } if (((this._cropDragPoint == CropDragPoint.None) && (Math.Abs((int)((cropBounds.Left + (cropBounds.Width / 2)) - e.X)) <= _cropRectSize)) && (Math.Abs((int)((cropBounds.Top + (cropBounds.Height / 2)) - e.Y)) <= _cropRectSize)) { this._cropDragPoint = CropDragPoint.Middle; } if (this._cropDragPoint != CropDragPoint.None) { this._mouseAction = MouseAction.DragCrop; } else if ((this._visibleSize.Width < this._imageSize.Width) || (this._visibleSize.Height < this._imageSize.Height)) { this._mouseAction = MouseAction.MoveImage; } } if (this._mouseAction != MouseAction.None) { this._mousePreviousPos = new Point(e.X, e.Y); } } }