// Hit test a location to see if it is over a handle. Return the handleLocation and handleCursor. bool HitTestHandle(PointF location, float pixelSize, out PointF handleLocation, out Cursor handleCursor) { PointF[] handles = selectingCourseObj.GetHandles(); foreach (PointF handle in handles) { double distance = Geometry.Distance(location, handle); if (distance / pixelSize <= 3.0) { // over a handle. handleLocation = handle; handleCursor = selectingCourseObj.GetHandleCursor(handle); return(true); } } // didn't find a handle. handleLocation = new PointF(); handleCursor = null; return(false); }