VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Small desktop clock

by MUKeSH RALHAN (1 Submission)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 6th May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Small desktop clock

API Declarations


Dim tm As Date
Dim xOff1, yOff1, xOff2, yOff2, xOff3, yOff3 As Integer
Dim l1, l2, l3 As Double


Rate Small desktop clock



    tmrLoad.Enabled = True
    l1 = Line1.Y1 - Line1.Y2
    l2 = Line2.Y1 - Line2.Y2
    l3 = Line3.Y1 - Line3.Y2
    
    allignneedle
    
    xOff1 = Line1.X2
    yOff1 = Line1.Y1
    
    xOff2 = Line2.X2
    yOff2 = Line2.Y1
    
    xOff3 = Line3.X2
    yOff3 = Line3.Y1
    settime
End Sub

Public Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    'If Button = 2 Then
      ' tmrUnload.Enabled = True
    'End If
    
End Sub

Private Sub Timer1_Timer()

    settime
End Sub
Sub settime()
    Dim h, m, s As Double
    tm = Time
    h = Hour(tm)
    m = Minute(tm)
    s = Second(tm)
    i = s * 6
    'Beep
    Line1.X2 = xOff1 + l1 * Sin(3.1416 / 180 * i)
    Line1.Y2 = yOff1 - l1 * Cos(3.1416 / 180 * i)
    
    j = m * 6 + s / 10
    
    Line2.X2 = xOff2 + l2 * Sin(3.1416 / 180 * j)
    Line2.Y2 = yOff2 - l2 * Cos(3.1416 / 180 * j)
    
    
    k = h * 30 + m / 2
'    Dim val As Integer
'    If Hour(tm) = 0 Then
'    val = MsgBox("Time to Sleep", vbInformation, "Good Night")
'    End If
    Line3.X2 = xOff3 + l3 * Sin(3.1416 / 180 * k)
    Line3.Y2 = yOff3 - l3 * Cos(3.1416 / 180 * k)
    

    lblDate.Caption = Date
End Sub
Sub allignneedle()
    Line1.Y1 = Dial.Top + Dial.Height / 2
    Line1.X1 = Dial.Left + Dial.Width / 2
    Line1.X2 = Line1.X1
    Line1.Y2 = Line1.Y1 - l1
    
    Line2.Y1 = Dial.Top + Dial.Height / 2
    Line2.X1 = Dial.Left + Dial.Width / 2
    Line2.X2 = Line2.X1
    Line2.Y2 = Line2.Y1 - l2
    
    Line3.Y1 = Dial.Top + Dial.Height / 2
    Line3.X1 = Dial.Left + Dial.Width / 2
    Line3.X2 = Line3.X1
    Line3.Y2 = Line3.Y1 - l3
    
End Sub



Private Sub tmrLoad_Timer()
Form1.Left = Form1.Left - 65
Form1.Top = Form1.Top - 65
If (Form1.Left <= 4000) Or (Form1.Top <= 2000) Then
tmrLoad.Enabled = False

End If
End Sub



Download this snippet    Add to My Saved Code

Small desktop clock Comments

No comments have been posted about Small desktop clock. Why not be the first to post a comment about Small desktop clock.

Post your comment

Subject:
Message:
0/1000 characters