Senin, 12 Januari 2009

Jam klasik dengan ms. access 2003

Private Sub Form_Timer()
Dim Dtk, Mnt, JariMenit As Byte
Dim JariDetik, Jam As Double



Dtk = Second(Now)
JariDetik = 2 * 2 ^ (1 / 2)

If (Dtk >= 0) And (Dtk < 15) Then
D015.Visible = True
D1530.Visible = False
D3045.Visible = False
D450.Visible = False

D015.Width = 567 * JariDetik * Sin(Dtk * 6 / 180 * 3.14159)
D015.Height = 567 * JariDetik * Cos(Dtk * 6 / 180 * 3.14159)
D015.Top = 3 * 567 - D015.Height

ElseIf (Dtk >= 15) And (Dtk < 30) Then
D015.Visible = False
D1530.Visible = True
D3045.Visible = False
D450.Visible = False

D1530.Width = 567 * Abs(JariDetik * Sin(Dtk * 6 / 180 * 3.14159))
D1530.Height = 567 * Abs(JariDetik * Cos(Dtk * 6 / 180 * 3.14159))

ElseIf (Dtk >= 30) And (Dtk < 45) Then
D015.Visible = False
D1530.Visible = False
D3045.Visible = True
D450.Visible = False

D3045.Width = Abs(567 * JariDetik * Sin(Dtk * 6 / 180 * 3.14159))
D3045.Height = Abs(567 * JariDetik * Cos(Dtk * 6 / 180 * 3.14159))
D3045.Left = 6 * 567 - D3045.Width

Else
D015.Visible = False
D1530.Visible = False
D3045.Visible = False
D450.Visible = True

D450.Width = 567 * Abs(JariDetik * Sin(Dtk * 6 / 180 * 3.14159))
D450.Height = 567 * Abs(JariDetik * Cos(Dtk * 6 / 180 * 3.14159))
D450.Top = 3 * 567 - D450.Height
D450.Left = 6 * 567 - D450.Width

End If



Mnt = Minute(Now)
JariMenit = 2

If (Mnt >= 0) And (Mnt < 15) Then
M015.Visible = True
M1530.Visible = False
M3045.Visible = False
M450.Visible = False

M015.Width = 567 * JariMenit * Sin(Mnt * 6 / 180 * 3.14159)
M015.Height = 567 * JariMenit * Cos(Mnt * 6 / 180 * 3.14159)
M015.Top = 3 * 567 - M015.Height

ElseIf (Mnt >= 15) And (Mnt < 30) Then
M015.Visible = False
M1530.Visible = True
M3045.Visible = False
M450.Visible = False

M1530.Width = 567 * Abs(JariMenit * Sin(Mnt * 6 / 180 * 3.14159))
M1530.Height = 567 * Abs(JariMenit * Cos(Mnt * 6 / 180 * 3.14159))

ElseIf (Mnt >= 30) And (Mnt < 45) Then
M015.Visible = False
M1530.Visible = False
M3045.Visible = True
M450.Visible = False

M3045.Width = Abs(567 * JariMenit * Sin(Mnt * 6 / 180 * 3.14159))
M3045.Height = Abs(567 * JariMenit * Cos(Mnt * 6 / 180 * 3.14159))
M3045.Left = 6 * 567 - M3045.Width

Else
M015.Visible = False
M1530.Visible = False
M3045.Visible = False
M450.Visible = True

M450.Width = 567 * Abs(JariMenit * Sin(Mnt * 6 / 180 * 3.14159))
M450.Height = 567 * Abs(JariMenit * Cos(Mnt * 6 / 180 * 3.14159))
M450.Top = 3 * 567 - M450.Height
M450.Left = 6 * 567 - M450.Width

End If



Jam = Hour(Now) + Mnt / 60
If Jam > 12 Then Jam = Jam Mod 12 + Mnt / 60

If (Jam >= 0) And (Jam < 3) Then
J015.Visible = True
J1530.Visible = False
J3045.Visible = False
J450.Visible = False

J015.Width = Abs(567 * Sin(Jam * 30 / 180 * 3.14159))
J015.Height = Abs(567 * Cos(Jam * 30 / 180 * 3.14159))
J015.Top = 3 * 567 - J015.Height

ElseIf (Jam >= 3) And (Jam < 6) Then
J015.Visible = False
J1530.Visible = True
J3045.Visible = False
J450.Visible = False

J1530.Width = 567 * Abs(Sin(Jam * 30 / 180 * 3.14159))
J1530.Height = 567 * Abs(Cos(Jam * 30 / 180 * 3.14159))

ElseIf (Jam >= 6) And (Jam < 9) Then
J015.Visible = False
J1530.Visible = False
J3045.Visible = True
J450.Visible = False

J3045.Width = Abs(567 * Sin(Jam * 30 / 180 * 3.14159))
J3045.Height = Abs(567 * Cos(Jam * 30 / 180 * 3.14159))
J3045.Left = 6 * 567 - J3045.Width

Else
J015.Visible = False
J1530.Visible = False
J3045.Visible = False
J450.Visible = True

J450.Width = 567 * Abs(Sin(Jam * 30 / 180 * 3.14159))
J450.Height = 567 * Abs(Cos(Jam * 30 / 180 * 3.14159))
J450.Top = 3 * 567 - J450.Height
J450.Left = 6 * 567 - J450.Width

End If


End Sub

1 komentar: