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