Line with arrow head

Here is a method that draws a simple arrow with two lines for an arrow tip:

[code]Public Sub DrawArrow(g as Graphics, FromX as double, FromY as double, ToX as double, ToY as Double, AThickness as Integer, AColour as Color)
Dim HeadLength as Double = 10
Dim Pi as Double = 3.1415926

//Set the arrow properties
Dim Angle as Double = ATan2(ToY-FromY,ToX-FromX)
g.ForeColor = AColour
g.PenHeight = AThickness
g.PenWidth = AThickness
g.DrawLine(FromX, FromY,ToX, ToY)

//Add the two lines for the arrowhead
g.DrawLine(ToX, ToY, ToX-HeadLengthCos(Angle-Pi/7), ToY-HeadLengthSin(Angle-Pi/7))
g.DrawLine(ToX, ToY, ToX-HeadLengthCos(Angle+Pi/7), ToY-HeadLengthSin(Angle+Pi/7))
End Sub
[/code]

Here is the line of code that is added to the Canvas Paint event:

Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint //Draw an arrow //g is graphics, FromX and FromY are the starting coordinates of the arrow //ToX and ToY are the arrow end points //AThickness is the arrow thickness //AColour is the arrow colour DrawArrow(g,5, 5, 100, 100, 2, &c11CCDD) End Sub

…and a screen grab of what the code makes…