analog clock

Page 1 of 1

1 Replies - 3060 Views - Last Post: 29 September 2009 - 06:33 AMRate Topic: 1 Votes //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=128793&amp;s=dfdc209b14adfa75ad8f547d27d8fc6b&md5check=' + ipb.vars['secure_hash'], cur_rating: 1, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 manvinder singh

Reputation: 0
• Posts: 1
• Joined: 29-September 09

analog clock

Posted 29 September 2009 - 03:43 AM

```Option Explicit
Const T As Double = 57.29577951

Me.Height = 2048
Me.Width = 2048
End Sub

Private Sub Form_Resize()
Me.ScaleHeight = 100
Me.ScaleWidth = 100
End Sub

Private Sub Timer1_Timer()
Dim H As Long, M As Long, S As Long                     'time units
Dim Hd As Double, Md As Double, Sd As Double            'Degrees
Dim Hr As Double, Mr As Double, Sr As Double            'Radians

Me.Cls
H = Hour(Time): M = Minute(Time): S = Second(Time)

If H >= 12 Then H = H - 12

Hd = H * 30
Hd = Hd + M / 2
Md = M * 6
Sd = S * 6

Hd = Hd - 90: Md = Md - 90: Sd = Sd - 90

If Hd < 0 Then Hd = Hd + 360
If Md < 0 Then Md = Md + 360
If Sd < 0 Then Sd = Sd + 360

Hr = Hd / T: Mr = Md / T: Sr = Sd / T

Line (50, 50)-(Me.ScaleHeight / 2 + ((Me.ScaleHeight / 2) * 0.5 * Cos(Hr)), Me.ScaleWidth / 2 + ((Me.ScaleHeight / 2) * 0.5 * Sin(Hr))), vbBlack
Line (50, 50)-(Me.ScaleHeight / 2 + ((Me.ScaleHeight / 2) * 0.6 * Cos(Mr)), Me.ScaleWidth / 2 + ((Me.ScaleHeight / 2) * 0.6 * Sin(Mr))), vbBlue
Line (50, 50)-(Me.ScaleHeight / 2 + ((Me.ScaleHeight / 2) * 0.7 * Cos(Sr)), Me.ScaleWidth / 2 + ((Me.ScaleHeight / 2) * 0.7 * Sin(Sr))), vbRed

End Sub
```

This post has been edited by JackOfAllTrades: 29 September 2009 - 06:40 AM

Is This A Good Question/Topic? 0

Replies To: analog clock

#2 vb5prgrmr

• D.I.C Lover

Reputation: 109
• Posts: 1,016
• Joined: 21-March 09

Re: analog clock

Posted 29 September 2009 - 06:33 AM