能不能给我个时钟是如何走动的例子 就一个秒摆就可以了
Dim arlph1 As Single
Dim arlph2 As Single
Dim arlph3 As Single
Const pi = 3.1415926
Private Sub Form_Load()
Timer1.Enabled = True
Timer1.Interval = 1000
a = Second(Now)
b = Minute(Now)
c = Hour(Now)
Picture1.Scale (-2, 2)-(2, -2)
Line1.X1 = 0
Line1.Y1 = 0
Line2.X1 = 0
Line2.Y1 = 0
Line3.X1 = 0
Line3.Y1 = 0
arlph1 = 5 / 2 * pi - a / 30 * pi
Line1.X2 = 1 * Cos(arlph1)
Line1.Y2 = 1 * Sin(arlph1)
arlph2 = 5 / 2 * pi - b / 30 * pi - (pi / 1800) * a
Line2.X2 = 0.8 * Cos(arlph2)
Line2.Y2 = 0.8 * Sin(arlph2)
arlph3 = 5 / 2 * pi - c / 6 * pi - (pi / 360) * b - (pi / 21600) * a
Line3.X2 = 0.6 * Cos(arlph3)
Line3.Y2 = 0.6 * Sin(arlph3)
End Sub
Private Sub timer1_timer()
Me.Caption = Str(Now())
arlph1 = arlph1 - 1 / 30 * pi
Line1.X2 = 1 * Cos(arlph1)
Line1.Y2 = 1 * Sin(arlph1)
arlph2 = arlph2 - 1 / 1800 * pi
Line2.X2 = 0.8 * Cos(arlph2)
Line2.Y2 = 0.8 * Sin(arlph2)
arlph3 = arlph3 - 1 / 21600 * pi
Line3.X2 = 0.6 * Cos(arlph3)
Line3.Y2 = 0.6 * Sin(arlph3)
End Sub
钟,添加一个timer控件,3个line控件.
[此贴子已经被作者于2007-1-5 10:17:36编辑过]