public void MouseMove(AbsoluteMouseEventArgs e) { Point mouseLocation = new Point((int)e.X, (int)e.Y); foreach (Shape shape in diagram.GetShapesInDisplayOrder()) { if (shape.BorderRectangle.Contains(mouseLocation)) { if (!firstSelected) { if (first != shape) { first = shape; diagram.Redraw(); } } else { if (second != shape) { second = shape; diagram.Redraw(); } } return; } } if (!firstSelected) { if (first != null) { first = null; diagram.Redraw(); } } else { if (second != null) { second = null; diagram.Redraw(); } } }