In Canvas Paint() Event
place, DrawArrow g,10,10,100,100,4,2 as an example.
Sub DrawArrow(g as Graphics, x1 as integer, y1 as Integer, x2 as integer, y2
as integer, w as integer, h as integer)
Dim pol(6),sgn as integer
Dim LinLen, LinAng as Double
sgn=(x2-x1)/abs(x2-x1)
if sgn1 then
sgn=-1
end if
LinLen=sqrt(pow(y1-y2,2)+pow(x1-x2,2))
LinAng=Atan((y1-y2)/(x1-x2))
g.drawline x1,y1,x2,y2
pol(1)=x2-cos(LinAng)*(h)*-sgn
pol(2)=y2-sin(LinAng)*(h)*-sgn
pol(3)=x2-cos((LinAng)-(w/10))*(10)*sgn
pol(4)=y2-sin((LinAng)-(w/10))*(10)*sgn
pol(5)=x2-cos((LinAng)+(w/10))*(10)*sgn
pol(6)=y2-sin((LinAng)+(w/10))*(10)*sgn
g.fillpolygon pol
End Sub

You must be logged in to post a comment.