Rectnagle RectangleFromPoints(Point A, Point B)//method 1 { //Finish this method... } int[] PointOnCurveBetween(Point P, GraphicsPath gp)//Method 2 { for(int i=1;i<gp.pointlist.Length; i++) { if(RectangleFromPoints( gp.Points[i-1],gp.Points[i]).Contains(P)) { return new int[]{i,i-1};} } }

At least that is the first way that comes to mind.. would work best if you knew the direction of the the curve(or you could determine the derivative of each sequence in method 1, and use switch/if statements)...

this will only work reliably when the function is 1-1 and somewhat well behaved.

alternativly if you "know" that they are clicking on the curve itself(no tollerance for user error ) you can do a least squares regression to each line segment, and then sort for the segment with the highest R value. -- this is more rigiourus, however will be slower then Method 1..(you could acomplist this also by using plane geometry/trigonometry, however that may be significantly slower due to the Math.(blah) functions which are "slow"..

--Incidently if you do use the least squares approach you wouldn't need to take the sqrt, just leave the numbers "big" and compare them the answer will still be the same.--Sometimes you don't need to be precise to do math.

-- I did something similar and you may want to try a "Node" approach, where you seperate the line segment into 2 ends and a center, each with a circle arround them equal to .25 the distance of the segment, this way you use a tree and get"closer" answers fast and then use more rigourus methods to determine the"correct" answer.

-good luck.