New Text Document
New Text Document
Drawing2D
Public Class Form1
End Sub
End Sub
Sub CalculatePerimeter()
Dim X, Y As Integer
Dim radius As Integer
For I As Integer = 1 To 60
If I Mod 5 = 0 Then
radius = 182
Else
radius = 190
End If
'Calculate Start Point
X = CInt(radius * Math.Cos((90 - I * 6) *
Convert)) + 220
Y = 220 - CInt(radius * Math.Sin((90 - I * 6) *
Convert))
StartPoint(I) = New PointF(X, Y)
'Calculate End Point
X = CInt(200 * Math.Cos((90 - I * 6) *
Convert)) + 220
Y = 220 - CInt(200 * Math.Sin((90 - I * 6) *
Convert))
EndPoint(I) = New PointF(X, Y)
Next
End Sub
Private Sub tmrClock_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles tmrClock.Tick
TimeString = Now.ToString("HH:mm:ss")
'Set The Angle of the Second, Minute and Hour hand
'according to the time
SecAngle = (Now.Second * 6)
MinAngle = (Now.Minute + Now.Second / 60) * 6
HrAngle = (Now.Hour + Now.Minute / 60) * 30
'Get the X,Y co-ordinates of the end point of each hand
SecX = CInt(SecRadius * Math.Cos((90 - SecAngle) *
Convert)) + 220
SecY = 220 - CInt(SecRadius * Math.Sin((90 - SecAngle) *
Convert))
MinX = CInt(MinRadius * Math.Cos((90 - MinAngle) *
Convert)) + 220
MinY = 220 - CInt(MinRadius * Math.Sin((90 - MinAngle) *
Convert))
HrX = CInt(HrRadius * Math.Cos((90 - HrAngle) *
Convert)) + 220
HrY = 220 - CInt(HrRadius * Math.Sin((90 - HrAngle) *
Convert))
Refresh()
End Sub
End Class