Ok, I have two controls in a Canvas that I can drag and drop. I need some help with an algorithm that finds the closest points between those two controls.
Any suggestions on how I can achieve this? I’m not fishing for code, but more help on the way! (even if the finished solution are welcome aswell. :P)
when I drag and drop these controls, the closest point should be recalculated and the line drawn between these updated. But that is another problem.
Finished component should be somewhat similar to Visio, where you can attach two controls with a line connecting those. Anything unclear, please tell me and I’ll update.
Best regards,
Gabriel
I will use a LineGeometry and use that to draw the line between two Points. This will generate a line that have a StartPoint and EndPoint and draw a line between those points. To this, I will have a object that have a property with a Point and a reference that will set the StartPoint or EndPoint depending on if its the Source or Receiver.
Read more on:
http://msdn.microsoft.com/en-us/library/system.windows.media.linegeometry.aspx