Public Class Orologio
Private Sub Orologio_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Secondi.Start()
Dim Ora2 As String
Me.BackColor = My.Settings.Sfondo
Ora.ForeColor = My.Settings.Primo_piano
If My.Computer.Clock.LocalTime.Hour.ToString.Length = 2 Then
Ora2 = My.Computer.Clock.LocalTime.Hour & ":"
Else
Ora2 = "0" & My.Computer.Clock.LocalTime.Hour & ":"
End If
If My.Computer.Clock.LocalTime.Minute.ToString.Length = 2 Then
Ora2 = Ora2 & My.Computer.Clock.LocalTime.Minute & ":"
Else
Ora2 = Ora2 & "0" & My.Computer.Clock.LocalTime.Minute & ":"
End If
If My.Computer.Clock.LocalTime.Second.ToString.Length = 2 Then
Ora2 = Ora2 & My.Computer.Clock.LocalTime.Second
Else
Ora2 = Ora2 & "0" & My.Computer.Clock.LocalTime.Second
End If
Ora.Text = Ora2
Catch ex As Exception
End Try
End Sub
Private Sub Secondi_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Secondi.Tick
Dim Ora2 As String
If My.Computer.Clock.LocalTime.Hour.ToString.Length = 2 Then
Ora2 = My.Computer.Clock.LocalTime.Hour & ":"
Else
Ora2 = "0" & My.Computer.Clock.LocalTime.Hour & ":"
End If
If My.Computer.Clock.LocalTime.Minute.ToString.Length = 2 Then
Ora2 = Ora2 & My.Computer.Clock.LocalTime.Minute & ":"
Else
Ora2 = Ora2 & "0" & My.Computer.Clock.LocalTime.Minute & ":"
End If
If My.Computer.Clock.LocalTime.Second.ToString.Length = 2 Then
Ora2 = Ora2 & My.Computer.Clock.LocalTime.Second
Else
Ora2 = Ora2 & "0" & My.Computer.Clock.LocalTime.Second
End If
Ora.Text = Ora2
End Sub
Private Sub Colore_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColoreSfondo.Click
SelezioneColore.ShowDialog()
Me.BackColor = SelezioneColore.Color
My.Settings.Sfondo = SelezioneColore.Color
End Sub
Private Sub ColorePrimoPiano_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorePrimoPiano.Click
SelezioneColore.ShowDialog()
Ora.ForeColor = SelezioneColore.Color
My.Settings.Primo_piano = SelezioneColore.Color
End Sub
Private Sub Chiudi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Chiudi.Click
Application.Exit()
End Sub
End Class