public bool MouseDown(MouseEventArgs e, Matrix transform) { Point[] pp = new Point[] { e.Location }; transform.TransformPoints(pp); Point location = pp[0]; if (e.Button == MouseButtons.Left) { if (state == State.NONE) { IDragable inside = getInsideDragabe(location); IDragable outside = getOutsideDragabe(location); if (inside != null) { dragged = inside; state = State.DRAGGEDINSIDE; inselected.SetSelectedState(2, 0); return(true); } else if (outside != null) { dragged = outside; state = State.DRAGGEDOUTSIDE; outselected.SetSelectedState(0, 2); return(true); } return(false); } } if (e.Button == MouseButtons.Right) { dragged = getInsideDragabe(location); if (dragged == null) { dragged = getOutsideDragabe(location); } if ((dragged != null) && (dragged.GetType() == typeof(ObstacleModel))) { contextMenuStrip.Items[1].Enabled = true; } else { contextMenuStrip.Items[1].Enabled = false; } contextMenuLocation = location; return(true); } return(false); }