| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 518 人关注过本帖
标题:求60个刻度的时钟代码翻译
只看楼主 加入收藏
gusdlr1325
Rank: 1
来 自:上海大学巴士汽车学院
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-6-13
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
求60个刻度的时钟代码翻译
Private Sub Form_Activate()
Me.Picture = LoadPicture(App.Path + "\004.jpg")
Dim i, angle
Me.Width = 6000: Me.Height = 6000: Left = Screen.Width \ 2 - 4100
Top = (Screen.Height - Height) \ 2 '定位窗体的在screen中的位置
For i = 0 To 62
If i > 0 Then
Load linClock(i)
    End If
   
    linClock(i).Visible = True
    linClock(i).BorderWidth = 5
    Select Case i
           Case 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
               linClock(i).BorderColor = RGB(0, 128, 0)
            
            Case Else
                 linClock(i).BorderColor = RGB(0, 0, 255)
    End Select
Next
For i = 0 To 60
   Scale (-1, -1)-(1, 1)
   angle = i * 6 * Atn(1) / 45
     If i Mod 5 = 0 Then
        linClock(i).X1 = 0.9 * Cos(angle)
        linClock(i).Y1 = 0.9 * Sin(angle)
    Else
        linClock(i).X1 = 0.99 * Cos(angle)
        linClock(i).Y1 = 0.99 * Sin(angle)
       End If
    linClock(i).X2 = Cos(angle)
    linClock(i).Y2 = Sin(angle)
  Next
  Call Timego
End Sub

Private Sub tmrclock_Timer()
Call Timego
End Sub

Sub Timego()
    Const HourHand = 0
    Const MinuteHand = 1
    Const SecondHand = 2
    Dim angle
    Static lastsecond
    Caption = Date & Space(3) & Time
    If Second(Now) = lastsecond Then Exit Sub
   
    lastsecond = Second(Now)
    angle = -0.5236 * (15 - (Hour(Now) + Minute(Now) / 60))
    linClock(HourHand).X1 = 0
    linClock(HourHand).Y1 = 0
    linClock(HourHand).X2 = 0.5 * Cos(angle)
    linClock(HourHand).Y2 = 0.5 * Sin(angle)
   
    angle = -0.1047 * (75 - (Minute(Now) + Second(Now) / 60))
   
    linClock(MinuteHand).X1 = 0
    linClock(MinuteHand).Y1 = 0
    linClock(MinuteHand).X2 = 0.7 * Cos(angle)
    linClock(MinuteHand).Y2 = 0.7 * Sin(angle)
   
    angle = -0.1047 * (75 - Second(Now))
   
    linClock(SecondHand).X1 = 0
    linClock(SecondHand).Y1 = 0
    linClock(SecondHand).X2 = 0.8 * Cos(angle)
    linClock(SecondHand).Y2 = 0.8 * Sin(angle)
   
End Sub
求这个工程的详细翻译在线等
搜索更多相关主题的帖子: screen 翻译 
2011-06-14 12:14
wube
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:23
帖 子:1820
专家分:3681
注 册:2011-3-24
收藏
得分:20 
蛮好玩~不过你这代码有小错误~帮你修了~

程序代码:
Option Explicit

Const HourHand = 0    'Line(0)=>linClock(0) 时针
Const MinuteHand = 1    'Line(1)=>linClock(1) 分针
Const SecondHand = 2    'Line(2)=>linClock(2) 秒针

Private Sub Form_Activate()     '画62只脚图
Dim i, angle

    Me.Picture = LoadPicture(App.Path + "\004.jpg")    '随便拉张JPG格式图改名就好了~当Form的背景~
    
    Me.Width = 6000: Me.Height = 6000: Left = Screen.Width \ 2 - 4100
    Top = (Screen.Height - Height) \ 2 '定位窗体的在screen中的位置
    
    Call Timego
    
    For i = 0 To 62
    
        If i > 2 Then
            Load linClock(i)
        End If
        
        linClock(i).Visible = True
        linClock(i).BorderWidth = 5
        
        Select Case i
        
            Case 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
                linClock(i).BorderColor = RGB(0, 128, 0)
            Case Else
                linClock(i).BorderColor = RGB(0, 0, 255)
                
        End Select
        
    Next
    
    For i = 0 To 62    '这边也要62才行~不然会少2条线~16和17分的标示线会消失~
    
       Scale (-1, -1)-(1, 1)    ' 设定自订座标系统。
       angle = i * 6 * Atn(1) / 45  '计算圆周率
       
         If i Mod 5 = 0 Then
            linClock(i).X1 = 0.9 * Cos(angle)
            linClock(i).Y1 = 0.9 * Sin(angle)
        Else
            linClock(i).X1 = 0.99 * Cos(angle)
            linClock(i).Y1 = 0.99 * Sin(angle)
        End If
        
        linClock(i).X2 = Cos(angle)
        linClock(i).Y2 = Sin(angle)
        
    Next i
    
    Call Timego
    
End Sub

Private Sub tmrclock_Timer()
    Call Timego
End Sub

Private Sub Timego()
Dim angle, i

    Static lastsecond
    
    Caption = Date & Space(3) & Time
    
    If Second(Now) = lastsecond Then Exit Sub
    
    lastsecond = Second(Now)
    angle = -0.5236 * (15 - (Hour(Now) + Minute(Now) / 60))
    
    linClock(HourHand).X1 = 0
    linClock(HourHand).Y1 = 0
    linClock(HourHand).X2 = 0.5 * Cos(angle)
    linClock(HourHand).Y2 = 0.5 * Sin(angle)
    
    angle = -0.1047 * (75 - (Minute(Now) + Second(Now) / 60))
    
    linClock(MinuteHand).X1 = 0
    linClock(MinuteHand).Y1 = 0
    linClock(MinuteHand).X2 = 0.7 * Cos(angle)
    linClock(MinuteHand).Y2 = 0.7 * Sin(angle)
    
    angle = -0.1047 * (75 - Second(Now))
    
    linClock(SecondHand).X1 = 0
    linClock(SecondHand).Y1 = 0
    linClock(SecondHand).X2 = 0.8 * Cos(angle)
    linClock(SecondHand).Y2 = 0.8 * Sin(angle)
    
End Sub


0-62跑出63条线~前3条用手拉~所以写>2之后才动态拉线~多出3条线用来画时针分针秒针用的~
一开始15+16+17~都重叠2条线~之后才被拉出去变成针~

我猜的~

[ 本帖最后由 wube 于 2011-6-14 17:34 编辑 ]

不要選我當版主
2011-06-14 17:27
gusdlr1325
Rank: 1
来 自:上海大学巴士汽车学院
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-6-13
收藏
得分:0 
回复 2楼 wube
谢谢
方便的话加个QQ可以不??
以后我做VB的请教你
我的QQ307311529
2011-06-15 08:17
快速回复:求60个刻度的时钟代码翻译
数据加载中...
 
   



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

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