/// <summary> /// Gets the appropriate <see cref="CursorToken"/> for a given point (in destination coordinates). /// </summary> /// <param name="point">the point (in destination coordinates).</param> /// <returns>a <see cref="CursorToken"/> that is appropriate for the given point, or null.</returns> public override CursorToken GetCursorToken(Point point) { if (_stretchIndicatorTokens.Count == 0) { return(null); } Platform.CheckForNullReference(ControlPoints, "_controlPoints"); int controlPointIndex = ControlPoints.HitTestControlPoint(point); if (controlPointIndex < 0) { return(null); } ControlPoints.CoordinateSystem = CoordinateSystem.Destination; PointF controlPoint = ControlPoints[controlPointIndex]; RectangleF containingRectangle = this.BoundingRectangle; CompassPoints closestCompassPoint = _stretchIndicatorTokens.Keys[0]; float minDistance = DistanceToCompassPoint(controlPoint, containingRectangle, closestCompassPoint); for (int i = 1; i < _stretchIndicatorTokens.Keys.Count; ++i) { CompassPoints compassPoint = _stretchIndicatorTokens.Keys[i]; float distance = DistanceToCompassPoint(controlPoint, containingRectangle, compassPoint); if (distance <= minDistance) { closestCompassPoint = compassPoint; minDistance = distance; } } ControlPoints.ResetCoordinateSystem(); return(_stretchIndicatorTokens[closestCompassPoint]); }