Hi Igor,
The nearest point in general can be found using the NPointFList.GetNearestPoint method. It takes a list of points and returns the point that is nearest to a specified point. You can create a list of the port locations like this:
List<NPointF> points = new List<NPointF>(); for (int i = shape.Ports.ChildrenCount - 1; i >= 0; i--)
{
NPort port = (NPort)shape.GetChildAt(i);
points.Add(port.Location);
}
If you are connecting a plug then you can use this technique to get the the nearest port to the plug location.
Best regards,
Ivo