0

I have a wpf ink canvas. i need to draw a line that connects two points on it. The scenario is that when i click on inkcanvas, my line should start and at mousedown event or so, that straight line should get created. please help. thank you.

Priyanka
  • 475
  • 6
  • 17

1 Answers1

1

Create a variable within the class to store the line and set it to nothing Then on the mouse click event for the inkcanvas check if x1 and y1 are set if not (or normal canvas) set x1, y1 else set x2, y2 and add the line to the canvas (setting you in code var back to nothing)

You could also use the mouse move event to continusly update x1, x2 until the user clicks so the user can preview their line.

apc
  • 5,306
  • 1
  • 17
  • 26