예제 #1
0
 private void DropPatch(Point location)
 {
     if (GetColorPatchAt(location) == null)
     {
         _grabbedPatch.GridLocation = new PointI((int)(location.X / _patchSize), (int)(location.Y / _patchSize));
         RaiseColorsModifiedEvent();
     }
     _grabbedPatch = null;
     InvalidateVisual();
 }
예제 #2
0
        private void CancelDrag()
        {
            if (_grabbedPatch == null)
            {
                return;
            }

            _isDragging   = false;
            _grabbedPatch = null;
            InvalidateVisual();
        }
예제 #3
0
        protected override void OnMouseDown(MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.ChangedButton != MouseButton.Left)
            {
                return;
            }

            _dragLocation      = e.GetPosition(this);
            _mouseDownLocation = _dragLocation;
            var patch = GetColorPatchAt(_dragLocation);

            if (patch != null)
            {
                _isDragging   = false; // we are not yet dragging until mouse has moved a small distance with the grabbed patch
                _grabbedPatch = patch;
                InvalidateVisual();
            }
        }
 public ColorPatchRoutedEventArgs(RoutedEvent routedEvent, ColorPatch colorPatch)
     : base(routedEvent)
 {
     ColorPatch = colorPatch;
 }