Hi

I am wanting to create a rectangle for two points (vector). I need a function that takes two points and a length and calculates a perpendicular point from line (vector) AB, to a given length.

I found this code, however it doesn't seem to work.

Private Function doit(ByVal a As PointF, ByVal b As PointF, ByVal l As Double) As PointF
Dim lfraction, dx, dy As Double
dx = b.X - a.X
dy = b.Y - a.Y
If dx = 0 And dy = 0 Then Exit Function
lfraction = l / Math.Sqrt(dx * dx + dy * dy)
Return New Point(b.X + lfraction * dy, b.Y + lfraction * dx)
End Function

Is there any easy or other methods i can use to create a rectangle from a line

Maybe a line stroke method or something.

Thanks

Gary