analog clock

I need to know the coding and designning of an analog clock using visu

Page 1 of 1

1 Replies - 1991 Views - Last Post: 29 September 2009 - 06:33 AM Rate Topic: *---- 1 Votes

#1 manvinder singh  Icon User is offline

  • New D.I.C Head

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

analog clock

Posted 29 September 2009 - 03:43 AM

Option Explicit
Const T As Double = 57.29577951

Private Sub Form_Load()
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


*** MOD EDIT: Added code tags. Please :code: ***

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  Icon User is offline

  • D.I.C Lover

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

Re: analog clock

Posted 29 September 2009 - 06:33 AM

Use your friends (google, yahoo, ask, answers, bing) http://www.planet-source-code.com as there are many examples out there...



Good Luck
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1