Option Explicit
Dim X0, Y0 As Integer
Private Sub Form_Load()
Let X0 = 2380
Let Y0 = 3110
Timer1.Enabled = True
Timer1.Interval = 100
Line1.X1 = X0
Line1.Y1 = Y0
Line2.Y1 = Y0
Line2.X1 = X0
Line3.X1 = X0
Line3.Y1 = Y0
End Sub
Private Sub Timer1_Timer()
Dim Angle
Static LastSecond
If Second(Now) = LastSecond Then Exit Sub
LastSecond = Second(Now)
'定位时针
Angle = -0.5236 * (15 - (Hour(Now) + Minute(Now) / 60))
Line1.X2 = 1 * Cos(Angle) * 1000 + X0
Line1.Y2 = 1 * Sin(Angle) * 1000 + Y0
'定位分针
Angle = -0.1047 * (75 - (Minute(Now) + Second(Now) / 60))
Line2.X2 = 1.4 * Cos(Angle) * 1000 + X0
Line2.Y2 = 1.4 * Sin(Angle) * 1000 + Y0
'定位秒针
Angle = -0.1047 * (75 - Second(Now))
Line3.X2 = 1.5 * Cos(Angle) * 1000 + X0
Line3.Y2 = 1.5 * Sin(Angle) * 1000 + Y0
End Sub