L'heure de plusieur pays - horloge mondiale

Soyez le premier à donner votre avis sur cette source.

Vue 7 641 fois - Téléchargée 599 fois

Description

trois horloges sont afficher : paris, chicago et bengalore (inde)

plusieurs lignes sont faite avec vb, mais le cadre n'est qu'un simple jpeg !

Source / Exemple :


Private Sub Pendule1(Heure As Single, Minute As Single, Seconde As Single)
Dim Cx, Cy As Single, Rayon As Single
Picture1.Cls
Cx = Picture1.ScaleWidth / 2 - 28
Cy = Picture1.ScaleHeight / 2 - 46
Dim X, Y As Single
Dim angle As Single
Dim Pi As Single
Pi = 4 * Atn(1)
angle = Pi / 2

Picture1.DrawWidth = 1
For r = 1100 To 1200
Do While angle < 5 * Pi / 2
X = Cos(angle) * (r + 30) + Cx
Y = Sin(angle) * r + Cy
Picture1.PSet (X, Y)
angle = angle + Pi / 6
Loop
angle = Pi / 2
Next
'la suite''''''
Picture1.DrawWidth = 2

Dim hx, hy As Single
r = 600
H = Heure
angle = H * Pi / 6 - Pi / 2
hx = Cos(angle) * r + Cx
hy = Sin(angle) * r + Cy
Picture1.Line (Cx, Cy)-(hx, hy)

Dim mx, my As Single
r = 1000
M = Minute
angle = M * Pi / 30 - Pi / 2
mx = Cos(angle) * r + Cx
my = Sin(angle) * r + Cy
Picture1.Line (Cx, Cy)-(mx, my)

Picture1.DrawWidth = 1
Dim sx, sy As Single
r = 1100
S = Seconde
angle = S * Pi / 30 - Pi / 2
sx = Cos(angle) * r + Cx
sy = Sin(angle) * r + Cy
Picture1.Line (Cx, Cy)-(sx, sy)

End Sub
Private Sub Pendule2(Heure As Single, Minute As Single, Seconde As Single)
Dim Cx, Cy As Single, Rayon As Single
Picture2.Cls
Cx = Picture2.ScaleWidth / 2 - 28
Cy = Picture2.ScaleHeight / 2 - 46
Dim X, Y As Single
Dim angle As Single
Dim Pi As Single
Pi = 4 * Atn(1)
angle = Pi / 2

Picture2.DrawWidth = 1
For r = 1100 To 1200
Do While angle < 5 * Pi / 2
X = Cos(angle) * (r + 30) + Cx
Y = Sin(angle) * r + Cy
Picture2.PSet (X, Y)
angle = angle + Pi / 6
Loop
angle = Pi / 2
Next
'la suite''''''
Picture2.DrawWidth = 2

Dim hx, hy As Single
r = 600
H = Heure
angle = H * Pi / 6 - Pi / 2
hx = Cos(angle) * r + Cx
hy = Sin(angle) * r + Cy
Picture2.Line (Cx, Cy)-(hx, hy)

Dim mx, my As Single
r = 1000
M = Minute
angle = M * Pi / 30 - Pi / 2
mx = Cos(angle) * r + Cx
my = Sin(angle) * r + Cy
Picture2.Line (Cx, Cy)-(mx, my)

Picture2.DrawWidth = 1
Dim sx, sy As Single
r = 1100
S = Seconde
angle = S * Pi / 30 - Pi / 2
sx = Cos(angle) * r + Cx
sy = Sin(angle) * r + Cy
Picture2.Line (Cx, Cy)-(sx, sy)

End Sub
Private Sub Pendule3(Heure As Single, Minute As Single, Seconde As Single)
Dim Cx, Cy As Single, Rayon As Single
Picture3.Cls
Cx = Picture3.ScaleWidth / 2 - 28
Cy = Picture3.ScaleHeight / 2 - 46
Dim X, Y As Single
Dim angle As Single
Dim Pi As Single
Pi = 4 * Atn(1)
angle = Pi / 2

Picture3.DrawWidth = 1
For r = 1100 To 1200
Do While angle < 5 * Pi / 2
X = Cos(angle) * (r + 30) + Cx
Y = Sin(angle) * r + Cy
Picture3.PSet (X, Y)
angle = angle + Pi / 6
Loop
angle = Pi / 2
Next
'la suite''''''
Picture3.DrawWidth = 2

Dim hx, hy As Single
r = 600
H = Heure
angle = H * Pi / 6 - Pi / 2
hx = Cos(angle) * r + Cx
hy = Sin(angle) * r + Cy
Picture3.Line (Cx, Cy)-(hx, hy)

Dim mx, my As Single
r = 1000
M = Minute
angle = M * Pi / 30 - Pi / 2
mx = Cos(angle) * r + Cx
my = Sin(angle) * r + Cy
Picture3.Line (Cx, Cy)-(mx, my)

Picture3.DrawWidth = 1
Dim sx, sy As Single
r = 1100
S = Seconde
angle = S * Pi / 30 - Pi / 2
sx = Cos(angle) * r + Cx
sy = Sin(angle) * r + Cy
Picture3.Line (Cx, Cy)-(sx, sy)

End Sub

Private Sub Timer1_Timer()
Dim H As Single, M As Single, S As Single
Dim H2 As Single, H3 As Single, M3 As Single
H = Hour(Time$)
M = Minute(Time$)
If M < 10 Then M = "0" & M
S = Second(Time$)
If S < 10 Then S = "0" & S
Label1.Caption = H & ":" & M & ":" & S
''heure de Chicago
H2 = H - 7: If H2 < 0 Then H2 = H2 + 24
Label2.Caption = H2 & ":" & M & ":" & S
''Heure de Bangalore
H3 = H + 3: If H3 > 23 Then H3 = H3 - 24
M3 = M + 30
If M3 > 60 Then
M3 = M3 - 60
H3 = H3 + 1
End If
If M3 < 10 Then M3 = 0 & M3
Label3.Caption = H3 & ":" & M3 & ":" & S
Call Pendule1(H, M, S)
Call Pendule2(H2, M, S)
Call Pendule3(H3, M3, S)
End Sub

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.