| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 542 人关注过本帖
标题:能不能给我个时钟是如何走动的例子
只看楼主 加入收藏
r316999443
Rank: 7Rank: 7Rank: 7
来 自:星城长沙
等 级:黑侠
威 望:1
帖 子:597
专家分:501
注 册:2006-11-7
结帖率:80%
收藏
 问题点数:0 回复次数:3 
能不能给我个时钟是如何走动的例子

能不能给我个时钟是如何走动的例子 就一个秒摆就可以了

搜索更多相关主题的帖子: 时钟 例子 
2007-01-05 09:48
wangyihua819
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-11-16
收藏
得分:0 

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编辑过]

2007-01-05 10:15
r316999443
Rank: 7Rank: 7Rank: 7
来 自:星城长沙
等 级:黑侠
威 望:1
帖 子:597
专家分:501
注 册:2006-11-7
收藏
得分:0 
谢谢啊
2007-01-05 11:01
ilike
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-12-11
收藏
得分:0 

ding

2007-01-07 23:52
快速回复:能不能给我个时钟是如何走动的例子
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.025245 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved