Reputation: 725
What I am trying to achieve is drawing a polygon programmatically based on mouse down events. Each mouse down event adds the current mouse point to the point collection of the polygon.
I also handle the mouse move events to add the current move point to the collection and remove the previous point.
Now I am able to achieve a polygon which is updated in real time.
What I want to do is to change the color of the line which joins the current move point and the first point (to complete the polygon).
Any help would be appreciated.
Upvotes: 0
Views: 1070
Reputation: 128136
You can't do it with a single Polyline. Instead you would have to use an additional Line
control (or a second Polyline) to draw the "current" line with the moving end point with a different stroke. When moving has finished, you would add the end point to the point collection of the Polyline.
This solution would also avoid repeated adding and removal of the moving point in the Polyline point collection, which each time forces a redraw of the whole Polyline.
Upvotes: 1