下面程序是一个有关电脑表的小例子,学习它我们可以看到数学在程序中的重要性,其实只要是关于图形,关
于逻辑的东西,都需要数学知识。有兴趣的朋友可以试试哦。
Private Sub Form_Load()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
Dim A, B, c, d, e, f
A = Minute(Time)
B = Second(Time)
e = Hour(Time)
f = e * 30 + A * 0.5
c = A * 6
d = B * 6
Line1(0).X1 = Line1(0).X2 + 150 * Sin((3.14 / 180) * d)
Line1(0).Y1 = Line1(0).Y2 - 150 * Cos((3.14 / 180) * d)
Line1(1).X1 = Line1(1).X2 + 136 * Sin((3.14 / 180) * c)
Line1(1).Y1 = Line1(1).Y2 - 136 * Cos((3.14 / 180) * c)
Line1(2).X1 = Line1(2).X2 + 110 * Sin((3.14 / 180) * f)
Line1(2).Y1 = Line1(2).Y2 - 110 * Cos((3.14 / 180) * f)
Form1.Caption = "时 钟: " & Format(Now, "hh:mm:ss")
End Sub
编程者 Bruce_guo