tags:

views:

63

answers:

1

Hi, I'm working on an application, that the user clicks 2 points on a control, and a line is drawn connecting those 2 points. The problem is that I need to draw another line that starts on X.Y (returned by a function) intersects the line generated by the user right in the center of it.

How can I do this?

I'm using DrawingVisual and DrawingContext for this.

Thanks

+2  A: 

Since you know the two points selected on the control, you can use the classic midpoint calculation:

(x1 + x2)/2, (y1 + y2)/2

to determine where you want to start your line that cuts through the middle. I'm sure DrawingVisual or DrawingContext has a simple line method that you can dump the coordinates into.

Dillie-O