sometimes drawing lines in circles, or at specific angles can get a bit confusing
here are some simple methods to do some of those, most have been posted in vb6 forum at some time, these methods should work in a picturebox or form, and probably printer
to draw a line from a point at an angle to a specific length
vb Code:
Dim n As Long, l As Long, x1 As Long, x2 As Long, y1 As Long, y2 As Long
Pic1.Cls
n = 60 'degrees, working clockwise
l = 1500 'length
X1 = 1800 ' starting points
Y1 = 1800
X2 = X1 + l * Sin(n * 3.142 / 180) 'ending points
Y2 = Y1 - l * Cos(n * 3.142 / 180)
Pic1.Line (X1, Y1)-(X2, Y2), vbRed ' draw the line
to put a spiral in a picturebox
vb Code:
Const radians = 3.142 / 180 ' pi could be specifies more accurately if required
Dim col() As Long, r1 As Double, r As Double, px As Double
Dim py As Double, cnt As Long, spir As Long, spirw As Double
Dim psx As Double, psy As Double
Pic1.Cls ' start fresh
px = Pic1.Width / 2
py = Pic1.Height / 2
r = 0 ' diameter of circle to sample 0 to start at center
cnt = 50 'no of point to in each circle
spir = 5 ' no of rings in spiral
spirw = (py - r) / spir / cnt
ReDim col(cnt * spir) ' total number of points
For i = 0 To cnt * spir - 1
r1 = 360 / cnt * (i) * radians '3.142 / 180
If Not i = 0 Then Pic1.Line (psx, psy)-(px + r * Sin(r1), py - r * Cos(r1)), vbRed ' draw line between points on spiral
' Pic1.PSet (px + r * Sin(r1), py - r * Cos(r1)), vbRed 'this will plot each point instaed of drawing a line
'****
psx = px + r * Sin(r1): psy = py - r * Cos(r1) ' remember point for next loop
' col(i) = Pic1.Point(px + r * Sin(r1), py - r * Cos(r1)) ' this will return the colour of the point into an array
r = r + spirw sets the radius for the next point
Next
End Sub
i will also attach a simple project of a clock the demonstrates positioning lines in a circle and moving line controls with a timer, note the resizing does not work correctly if the window is maximised, i have tried to explain all the processes, except the actual math