Under the MouseLeftButtonUp event handker store the first coordinates of the lines second endpoint. Then call the length method to obtain the distance between the two endpoints(the lines length). Fianlly display the line on the canvas and the line's length in the Length=Label. Below is the code I have so far. There are no errors, but when I run the application nothing happens.
view sourceprint?01 Private Sub lineCanvas_MouseLeftButtonUp(ByVal sender As Object, ByVal e As System.Windows.Input.MouseButtonEventArg… Handles lineCanvas.MouseLeftButtonUp
02 Dim distance As Double
03
04 endPoint = e.GetPosition(lineCanvas)
05 distance = Length()
06
07 Dim myline As New Line
08
09 myline.X1 = startPoint.X
10 myline.X2 = endPoint.X
11 myline.Y1 = startPoint.Y
12 myline.Y2 = endPoint.Y
13 myline.Stroke = Brushes.Black
14
15
16 myline.StrokeThickness = 1
17 lineCanvas.Children.Add(myline)
18 Length.Content = distance