maybe something like this ?
this is in the paint event of a canvas placed on window1
the window has a textfield for angle and step size
If txtAngle.Text.Trim = "" Or txtStep.Text.Trim = "" Then
Return
End If
Const pi = 3.1415926535897932384626433
Dim angle As Double = Val(txtAngle.Text)
Dim stepSize As Integer = Val(txtStep.Text)
If angle = 0 Or stepsize = 0 Then
Return
End If
Dim angleInRadians As Double = (angle * pi) / 180
Dim lineLength As Integer = g.width * 3
g.forecolor = &cFFFFFF
Dim x1 As Double
Dim x2 As Double
Dim y1 As Double
Dim y2 As Double
// make sure we start drawing down & right far enough off the LEFT edge that the X2 starts <= 0
Dim x1Start As Double
x2 = x1Start + lineLength * Cos(angleInRadians)
While x2 > 0
x1Start = x1Start - stepSize
x2 = x1Start + lineLength * Cos(angleInRadians)
Wend
// draw down and right from the top edge
x1 = x1Start
y1 = 0
Do
// now compute x2, y2
x2 = x1 + lineLength * Cos(angleInRadians)
y2 = y1 + lineLength * Sin(angleInRadians)
g.DrawLine x1, y1, x2, y2
x1 = x1 + stepSize
Loop Until x1 > g.width
// draw down and left from the top edge
x1 = 0
y1 = 0
Do
// now compute x2, y2
x2 = x1 - lineLength * Cos(angleInRadians)
y2 = y1 + lineLength * Sin(angleInRadians)
g.DrawLine x1, y1, x2, y2
x1 = x1 + stepSize
Loop Until x2 > g.width