public bool MouseMove(MouseEventArgs e, Matrix transform) { Point[] pp = new Point[] { e.Location }; transform.TransformPoints(pp); Point location = pp[0]; if (state == State.DRAGGEDINSIDE) { lock (dragged) { if ((Control.ModifierKeys & Keys.Control) != 0) { if (((DateTime.Now - lastCtrlTime).Milliseconds > 200) || ((lastCtrlLocation.X - location.X) * (lastCtrlLocation.X - location.X) + (lastCtrlLocation.Y - location.Y) * (lastCtrlLocation.Y - location.Y) > 100)) { dragged.SetPosition(location, true); lastCtrlTime = DateTime.Now; lastCtrlLocation = location; } } else { dragged.SetPosition(location, false); } } TakeSample(); return(true); } else if (state == State.DRAGGEDOUTSIDE) { dragged.SetSecondParameterAgainstPosition(location); TakeSample(); return(true); } else if ((state == State.NONE) && (e.Button == MouseButtons.None)) { IDragable inside = getInsideDragabe(location); IDragable outside = getOutsideDragabe(location); if (inside != null) { if (inselected != inside) { graphicControl.Cursor = Cursors.Hand; if (inselected != null) { inselected.SetSelectedState(0, 0); } inselected = inside; outselected = null; inselected.SetSelectedState(1, 0); } return(true); } else if (outside != null) { if (outselected != outside) { graphicControl.Cursor = Cursors.NoMove2D; if (outselected != null) { outselected.SetSelectedState(0, 0); } outselected = outside; inselected = null; outselected.SetSelectedState(0, 1); } return(true); } else { if ((outselected != null) || (inselected != null)) { graphicControl.Cursor = Cursors.Arrow; if (outselected != null) { outselected.SetSelectedState(0, 0); } if (inselected != null) { inselected.SetSelectedState(0, 0); } outselected = null; inselected = null; return(true); } return(false); } } return(false); }