|
-
Jan 30th, 2000, 03:04 PM
#1
Thread Starter
New Member
Here is the code for my clock.
Option Explicit
DefDbl A-Z
Private Sub Form_Load()
Width = 4000
Height = 4000
Left = Screen.Width \ 2 - 4100
Top = (Screen.Height - Height) \ 2
End Sub
Private Sub Form_Resize()
Dim i, Angle
Static Flag As Boolean
If Flag = False Then
Flag = True
For i = 0 To 14
If i > 0 Then Load linClock(i)
linClock(i).Visible = True
linClock(i).BorderWidth = 5
linClock(i).BorderColor = RGB(0, 128, 0)
Next i
End If
For i = 0 To 14
Scale (-1, 1)-(1, -1)
Angle = i * 2 * Atn(1) / 3
linClock(i).X1 = 0.9 * Cos(Angle)
linClock(i).Y1 = 0.9 * Sin(Angle)
linClock(i).X2 = Cos(Angle)
linClock(i).Y2 = Sin(Angle)
Next i
End Sub
Private Sub tmrClock_Timer()
Const HourHand = 0
Const MinuteHand = 13
Const SecondHand = 14
Dim Angle
Static LastSecond
' Position hands only on the second
If Second(Now) = LastSecond Then Exit Sub
LastSecond = Second(Now)
' Position hour hand
Angle = 0.5236 * (15 - (Hour(Now) + Minute(Now) / 60))
linClock(HourHand).X1 = 0
linClock(HourHand).Y1 = 0
linClock(HourHand).X2 = 0.3 * Cos(Angle)
linClock(HourHand).Y2 = 0.3 * Sin(Angle)
' Position minute hand
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)
' Position second hand
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
The form is a simple form with 1 line and a timer control.
I will add some code that you have written here to see if it works. My goal is to have the user enter what time zone they want to see and it shows the appropriate clock based on what they want. I have one clock so far in an MDI form. I just have to have a mnu item so that the user can select the time zone they want and it shows up in the MDI form. The clock stays up until the user needs to have more room where they would close the child form clock. This is primaraly the basis of the program. If anyone would like to help me out e-mail me at [email protected].
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|