private void AnimationControl_MouseMove(object sender, MouseEventArgs e) { if (this.MouseDragEnabled && this.mouseDragContext.IsDragging && this.mouseDragContext.DraggingItem != null) { this.mouseDragContext.DraggingItem.Position = new Point( e.X - mouseDragContext.MouseDownPoint.X + mouseDragContext.StartPosition.X, e.Y - mouseDragContext.MouseDownPoint.Y + mouseDragContext.StartPosition.Y); //处理拖拽保存 if (this.MouseDragSaveEnabled && (Control.ModifierKeys & Keys.Control) != 0) { var dragSize = SystemInformation.DragSize; var dragBox = new Rectangle(mouseDragContext.MouseDownPoint, new Point(dragSize.Width, dragSize.Height)); if (!dragBox.Contains(new Point(e.X, e.Y))) { var e2 = new AnimationItemEventArgs(this.mouseDragContext.DraggingItem); this.OnItemDragSave(e2); if (e2.Handled) { this.mouseDragContext.IsDragging = false; } } } } }
protected virtual void OnItemDragSave(AnimationItemEventArgs e) { }