| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 448 人关注过本帖
标题:指针式时钟 不明白怎么该
取消只看楼主 加入收藏
insoyang
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2011-5-5
结帖率:0
收藏
已结贴  问题点数:10 回复次数:0 
指针式时钟 不明白怎么该
Private Sub Form_Load()
    pi = 3.14159265358979
    cx = Me.ScaleWidth / 2
    cy = Me.ScaleHeight / 2
    Scale (-cx, cy)-(cx, -cy)
    For I = 1 To 12
        alf = pi * (I - 1) / 6
        Load Line4(I)
        Line4(I).X1 = 1000 * Cos(alf)
        Line4(I).Y1 = 1000 * Cos(alf)
        Line4(I).X2 = 1200 * Cos(alf)
        Line4(I).Y2 = 1200 * Cos(alf)
        Line4(I).Visible = Ture
        Next I
End Sub

Private Sub Form_Paint()
    Circle (0, 0), 1400
End Sub

Private Sub Timer1_Timer()
    hh = Hour(Time) Mod 12
    mm = Minute(Time)
    ss = Second(Time)
    alf = ss * pi / 30 + pi / 2
    Line3.X1 = 100 * Cos(alf)
    Line3.Y1 = -100 * Sin(alf)
    Line3.X2 = 1000 * Cos(alf - pi)
    Line3.Y2 = -1000 * Sin(alf - pi)
    alf = mm * pi / 30 + pi / 2
    Line2.X1 = 100 * Cos(alf)
    Line2.Y1 = -100 * Sin(alf)
    Line2.X2 = 900 * Cos(alf - pi)
    Line2.Y2 = -900 * Sin(alf - pi)
    alf = hh * pi / 6 + mm * pi / 360 + pi / 2
    Line1.X1 = 100 * Cos(alf)
    Line1.Y1 = -100 * Sin(alf)
    Line1.X2 = 700 * Cos(alf - pi)
    Line1.Y2 = -700 * Sin(alf - pi)   
End Sub
图片附件: 游客没有浏览图片的权限,请 登录注册
Private Sub Form_Load()
    pi = 3.14159265358979
    cx = Me.ScaleWidth / 2
    cy = Me.ScaleHeight / 2
    Scale (-cx, cy)-(cx, -cy)
    For I = 1 To 12
        alf = pi * (I - 1) / 6
        Load Line4(I)
        Line4(I).X1 = 1000 * Cos(alf)
        Line4(I).Y1 = 1000 * Cos(alf)
        Line4(I).X2 = 1200 * Cos(alf)
        Line4(I).Y2 = 1200 * Cos(alf)
        Line4(I).Visible = Ture
        Next I
End Sub

Private Sub Form_Paint()
    Circle (0, 0), 1400
End Sub

Private Sub Timer1_Timer()
    hh = Hour(Time) Mod 12
    mm = Minute(Time)
    ss = Second(Time)
    alf = ss * pi / 30 + pi / 2
    Line3.X1 = 100 * Cos(alf)
    Line3.Y1 = -100 * Sin(alf)
    Line3.X2 = 1000 * Cos(alf - pi)
    Line3.Y2 = -1000 * Sin(alf - pi)
    alf = mm * pi / 30 + pi / 2
    Line2.X1 = 100 * Cos(alf)
    Line2.Y1 = -100 * Sin(alf)
    Line2.X2 = 900 * Cos(alf - pi)
    Line2.Y2 = -900 * Sin(alf - pi)
    alf = hh * pi / 6 + mm * pi / 360 + pi / 2
    Line1.X1 = 100 * Cos(alf)
    Line1.Y1 = -100 * Sin(alf)
    Line1.X2 = 700 * Cos(alf - pi)
    Line1.Y2 = -700 * Sin(alf - pi)   
End Sub
搜索更多相关主题的帖子: 1200 
2011-05-17 16:38
快速回复:指针式时钟 不明白怎么该
数据加载中...
 
   



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

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