Horloge invérse

Le
djebbi-farouk
Bonjou
je cherche comment faire une horloge inveré c'est a dire je configuré mon horloge avec 15 min puis lohorloge travaille de manier inveré c'est a dir 15:00 -> 14:59 -> 15:48 . -> 1:02 --> 00:00
Vidéos High-Tech et Jeu Vidéo
Téléchargements
Vos réponses
Gagnez chaque mois un abonnement Premium avec GNT : Inscrivez-vous !
Trier par : date / pertinence
Noex
Le #19105051
djebbi-farouk a écrit :
Bonjou
je cherche comment faire une horloge inveré c'est a dire je configuré mon
horloge avec 15 min puis lohorloge travaille de manier inveré c'est a dir
15:00 -> 14:59 -> 15:48 .... -> 1:02 --> 00:00



ça doit être un compte à rebours! Bien que 14:59 -> 15h48... -> ... ?!

J'ai bon ?

c'est le folklore en ce moment.


Pas le temps de détailler mais gougeule donne pleins de bonnes
réponses!

http://www.google.fr/search?hl=fr&q=compte+a+rebours+vb6&btnG=Recherche+Google&meta=&aq=0&oq
bye.
David
Le #19106481
Bonjour,

Si cela peut vous aider voici un extrait de code pour une
horloge (qui avance dans le sens normal) avec l'utilisation
de sinus et cosinus pour la position des minutes et des secondes.

Faut dans la form
1 timer
3 line (qu'importe la dimension et la position)
1 cercle (idem)

Vous pouvez étirer la form et l'horloge s'agrandi.

Ce programme est extrait d'un écran de veille, certaines
variables peuvent être, ici, superfétatoires !

--
a+ Jean-Pol
Site Web : www.colovid.be
Site Web perso pour le fun : http://users.skynet.be/DAVID/
Cette page est transmise avec des électrons 100% recyclés.



'''Option Explicit
Private BufferTime As Single
Private PwMode As Boolean
Dim HourLength As Integer, MinuteLength As Integer, _
SecondLength As Integer
Dim MidX As Integer, MidY As Integer
Const PI = 3.14159
Dim Seconds As Single



Private Sub Form_Load()


Shape1.BorderWidth = 4
Shape1.BorderColor = vbYellow
Line1.BorderWidth = 20 '5
Line1.BorderColor = vbBlue

Line2.BorderWidth = 15 '3
Line2.BorderColor = vbRed 'vbBlue

Line3.BorderWidth = 1 ' 3 '1
Line3.BorderColor = vbBlack
'
Timer1.Interval = 1000
'
End Sub

Private Sub Form_Resize()
On Error Resume Next
Call LengthAndCentre
Call DrawDial
End Sub

Private Sub Timer1_Timer()
Dim Hours As Single, Minutes As Single ', Seconds As Single
Dim TrueHours As Single
'Beep
Hours = Hour(Time)
Minutes = Minute(Time)
Seconds = Second(Time)
TrueHours = Hours + Minutes / 60
'Heure
Line1.X2 = HourLength * Cos(PI / 180 * (30 * TrueHours - 90)) + MidX
Line1.Y2 = HourLength * Sin(PI / 180 * (30 * TrueHours - 90)) + MidY
'Minute
Line2.X2 = MinuteLength * Cos(PI / 180 * (6 * Minutes - 90)) + MidX
Line2.Y2 = MinuteLength * Sin(PI / 180 * (6 * Minutes - 90)) + MidY
'Seconds
Line3.X2 = SecondLength * Cos(PI / 180 * (6 * Seconds - 90)) + MidX
Line3.Y2 = SecondLength * Sin(PI / 180 * (6 * Seconds - 90)) + MidY


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If


If Seconds = 0 Then

Me.Cls
For I = 1 To 12
Me.DrawWidth = 6 '10
ForeColor = QBColor(15)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)
Next I

For I = 1 To 59
Me.DrawWidth = 4
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
''MsgBox (MinuteX)

Else

II = Seconds
Select Case II
Case 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
Me.DrawWidth = 6
ForeColor = QBColor(0)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)
Case Else
Me.DrawWidth = 4
ForeColor = QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)

End Select

End If

End Sub
Sub LengthAndCentre()
Dim d As Integer


If Me.ScaleWidth < Me.ScaleHeight Then
HourLength = Me.ScaleWidth * 50 / 200 ' 50%
MinuteLength = Me.ScaleWidth * 80 / 200 ' 80%
SecondLength = Me.ScaleWidth * 90 / 200 ' 80 %90%
Else
HourLength = Me.ScaleHeight * 50 / 200 ' 50%
MinuteLength = Me.ScaleHeight * 80 / 200 ' 80%
SecondLength = Me.ScaleHeight * 90 / 200 ' 90%
End If
MidX = Me.ScaleWidth 2
MidY = Me.ScaleHeight 2
Line1.X1 = MidX
Line2.X1 = MidX
Line3.X1 = MidX
'
Line1.Y1 = MidY
Line2.Y1 = MidY
Line3.Y1 = MidY
d = Shape1.BorderWidth 2
Shape1.Left = d
Shape1.Top = d
Shape1.Width = Me.ScaleWidth - d * 2
Shape1.Height = Me.ScaleHeight - d * 2
Call Timer1_Timer
End Sub
Private Sub DrawDial()

Dim I, HourX, HourY, MinuteX, MinuteY, DialLength As Integer
Me.Cls


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If



For I = 1 To 12
Me.DrawWidth = 6 '4
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor =
QBColor(1)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)

Next I


For I = 1 To 59
Me.DrawWidth = 4 '2
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor =
QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
End Sub


"djebbi-farouk" news:
Bonjou
je cherche comment faire une horloge inveré c'est a dire je configuré mon
horloge avec 15 min puis lohorloge travaille de manier inveré c'est a dir
15:00
-> 14:59 -> 15:48 .... -> 1:02 --> 00:00


djebbi-farouk
Le #19106881
David a écrit le 13/04/2009 à 10h43 :
Bonjour,

Si cela peut vous aider voici un extrait de code pour une
horloge (qui avance dans le sens normal) avec l'utilisation
de sinus et cosinus pour la position des minutes et des secondes.

Faut dans la form
1 timer
3 line (qu'importe la dimension et la position)
1 cercle (idem)

Vous pouvez étirer la form et l'horloge s'agrandi.

Ce programme est extrait d'un écran de veille, certaines
variables peuvent être, ici, superfétatoires !

--
a+ Jean-Pol
Site Web : www.colovid.be
Site Web perso pour le fun : http://users.skynet.be/DAVID/
Cette page est transmise avec des électrons 100% recyclés.



'''Option Explicit
Private BufferTime As Single
Private PwMode As Boolean
Dim HourLength As Integer, MinuteLength As Integer, _
SecondLength As Integer
Dim MidX As Integer, MidY As Integer
Const PI = 3.14159
Dim Seconds As Single



Private Sub Form_Load()


Shape1.BorderWidth = 4
Shape1.BorderColor = vbYellow
Line1.BorderWidth = 20 '5
Line1.BorderColor = vbBlue

Line2.BorderWidth = 15 '3
Line2.BorderColor = vbRed 'vbBlue

Line3.BorderWidth = 1 ' 3 '1
Line3.BorderColor = vbBlack
'
Timer1.Interval = 1000
'
End Sub

Private Sub Form_Resize()
On Error Resume Next
Call LengthAndCentre
Call DrawDial
End Sub

Private Sub Timer1_Timer()
Dim Hours As Single, Minutes As Single ', Seconds As Single
Dim TrueHours As Single
'Beep
Hours = Hour(Time)
Minutes = Minute(Time)
Seconds = Second(Time)
TrueHours = Hours + Minutes / 60
'Heure
Line1.X2 = HourLength * Cos(PI / 180 * (30 * TrueHours - 90)) + MidX
Line1.Y2 = HourLength * Sin(PI / 180 * (30 * TrueHours - 90)) + MidY
'Minute
Line2.X2 = MinuteLength * Cos(PI / 180 * (6 * Minutes - 90)) + MidX
Line2.Y2 = MinuteLength * Sin(PI / 180 * (6 * Minutes - 90)) + MidY
'Seconds
Line3.X2 = SecondLength * Cos(PI / 180 * (6 * Seconds - 90)) + MidX
Line3.Y2 = SecondLength * Sin(PI / 180 * (6 * Seconds - 90)) + MidY


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If


If Seconds = 0 Then

Me.Cls
For I = 1 To 12
Me.DrawWidth = 6 '10
ForeColor = QBColor(15)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)
Next I

For I = 1 To 59
Me.DrawWidth = 4
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
''MsgBox (MinuteX)

Else

II = Seconds
Select Case II
Case 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
Me.DrawWidth = 6
ForeColor = QBColor(0)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)
Case Else
Me.DrawWidth = 4
ForeColor = QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)

End Select

End If

End Sub
Sub LengthAndCentre()
Dim d As Integer


If Me.ScaleWidth < Me.ScaleHeight Then
HourLength = Me.ScaleWidth * 50 / 200 ' 50%
MinuteLength = Me.ScaleWidth * 80 / 200 ' 80%
SecondLength = Me.ScaleWidth * 90 / 200 ' 80 %90%
Else
HourLength = Me.ScaleHeight * 50 / 200 ' 50%
MinuteLength = Me.ScaleHeight * 80 / 200 ' 80%
SecondLength = Me.ScaleHeight * 90 / 200 ' 90%
End If
MidX = Me.ScaleWidth 2
MidY = Me.ScaleHeight 2
Line1.X1 = MidX
Line2.X1 = MidX
Line3.X1 = MidX
'
Line1.Y1 = MidY
Line2.Y1 = MidY
Line3.Y1 = MidY
d = Shape1.BorderWidth 2
Shape1.Left = d
Shape1.Top = d
Shape1.Width = Me.ScaleWidth - d * 2
Shape1.Height = Me.ScaleHeight - d * 2
Call Timer1_Timer
End Sub
Private Sub DrawDial()

Dim I, HourX, HourY, MinuteX, MinuteY, DialLength As Integer
Me.Cls


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If



For I = 1 To 12
Me.DrawWidth = 6 '4
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor =
QBColor(1)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)

Next I


For I = 1 To 59
Me.DrawWidth = 4 '2
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor =
QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
End Sub


"djebbi-farouk" a écrit
dans le message de
news:
Bonjou
je cherche comment faire une horloge inveré c'est a dire je
configuré mon
horloge avec 15 min puis lohorloge travaille de manier inveré c'est a
dir
15:00
-> 14:59 -> 15:48 .... -> 1:02 --> 00:00





merci mais mon broblem dans l'orloge inverse !!!!!!!!!
David
Le #19107311
Bonjour,

Là ça me parait clair;
vous prenez le temps T de votre ordinateur
et chaque fois que votre ordinateur est à T + 60 secondes
vous faites reculer l'aiguille d'une graduation (avec sinus et cosinus).

--
a+ Jean-Pol
Site Web : www.colovid.be
Site Web perso pour le fun : http://users.skynet.be/DAVID/
Cette page est transmise avec des électrons 100% recyclés.


"djebbi-farouk" news:
David a écrit le 13/04/2009 à 10h43 :
Bonjour,

Si cela peut vous aider voici un extrait de code pour une
horloge (qui avance dans le sens normal) avec l'utilisation
de sinus et cosinus pour la position des minutes et des secondes.

Faut dans la form
1 timer
3 line (qu'importe la dimension et la position)
1 cercle (idem)

Vous pouvez étirer la form et l'horloge s'agrandi.

Ce programme est extrait d'un écran de veille, certaines
variables peuvent être, ici, superfétatoires !

--
a+ Jean-Pol
Site Web : www.colovid.be
Site Web perso pour le fun : http://users.skynet.be/DAVID/
Cette page est transmise avec des électrons 100% recyclés.



'''Option Explicit
Private BufferTime As Single
Private PwMode As Boolean
Dim HourLength As Integer, MinuteLength As Integer, _
SecondLength As Integer
Dim MidX As Integer, MidY As Integer
Const PI = 3.14159
Dim Seconds As Single



Private Sub Form_Load()


Shape1.BorderWidth = 4
Shape1.BorderColor = vbYellow
Line1.BorderWidth = 20 '5
Line1.BorderColor = vbBlue

Line2.BorderWidth = 15 '3
Line2.BorderColor = vbRed 'vbBlue

Line3.BorderWidth = 1 ' 3 '1
Line3.BorderColor = vbBlack
'
Timer1.Interval = 1000
'
End Sub

Private Sub Form_Resize()
On Error Resume Next
Call LengthAndCentre
Call DrawDial
End Sub

Private Sub Timer1_Timer()
Dim Hours As Single, Minutes As Single ', Seconds As Single
Dim TrueHours As Single
'Beep
Hours = Hour(Time)
Minutes = Minute(Time)
Seconds = Second(Time)
TrueHours = Hours + Minutes / 60
'Heure
Line1.X2 = HourLength * Cos(PI / 180 * (30 * TrueHours - 90)) + MidX
Line1.Y2 = HourLength * Sin(PI / 180 * (30 * TrueHours - 90)) + MidY
'Minute
Line2.X2 = MinuteLength * Cos(PI / 180 * (6 * Minutes - 90)) + MidX
Line2.Y2 = MinuteLength * Sin(PI / 180 * (6 * Minutes - 90)) + MidY
'Seconds
Line3.X2 = SecondLength * Cos(PI / 180 * (6 * Seconds - 90)) + MidX
Line3.Y2 = SecondLength * Sin(PI / 180 * (6 * Seconds - 90)) + MidY


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If


If Seconds = 0 Then

Me.Cls
For I = 1 To 12
Me.DrawWidth = 6 '10
ForeColor = QBColor(15)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)
Next I

For I = 1 To 59
Me.DrawWidth = 4
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
''MsgBox (MinuteX)

Else

II = Seconds
Select Case II
Case 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55
Me.DrawWidth = 6
ForeColor = QBColor(0)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)
Case Else
Me.DrawWidth = 4
ForeColor = QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * II - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * II - 90)) + MidY
PSet (MinuteX, MinuteY)

End Select

End If

End Sub
Sub LengthAndCentre()
Dim d As Integer


If Me.ScaleWidth < Me.ScaleHeight Then
HourLength = Me.ScaleWidth * 50 / 200 ' 50%
MinuteLength = Me.ScaleWidth * 80 / 200 ' 80%
SecondLength = Me.ScaleWidth * 90 / 200 ' 80 %90%
Else
HourLength = Me.ScaleHeight * 50 / 200 ' 50%
MinuteLength = Me.ScaleHeight * 80 / 200 ' 80%
SecondLength = Me.ScaleHeight * 90 / 200 ' 90%
End If
MidX = Me.ScaleWidth 2
MidY = Me.ScaleHeight 2
Line1.X1 = MidX
Line2.X1 = MidX
Line3.X1 = MidX
'
Line1.Y1 = MidY
Line2.Y1 = MidY
Line3.Y1 = MidY
d = Shape1.BorderWidth 2
Shape1.Left = d
Shape1.Top = d
Shape1.Width = Me.ScaleWidth - d * 2
Shape1.Height = Me.ScaleHeight - d * 2
Call Timer1_Timer
End Sub
Private Sub DrawDial()

Dim I, HourX, HourY, MinuteX, MinuteY, DialLength As Integer
Me.Cls


If Me.ScaleWidth < Me.ScaleHeight Then
DialLength = Me.ScaleWidth * 92 / 200 ' 92%
Else
DialLength = Me.ScaleHeight * 92 / 200 ' 92%
End If



For I = 1 To 12
Me.DrawWidth = 6 '4
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor >> QBColor(1)
HourX = DialLength * Cos(PI / 180 * (30 * I - 90)) + MidX
HourY = DialLength * Sin(PI / 180 * (30 * I - 90)) + MidY
PSet (HourX, HourY)

Next I


For I = 1 To 59
Me.DrawWidth = 4 '2
If Seconds < I Then ForeColor = QBColor(15) Else ForeColor >> QBColor(1)
MinuteX = DialLength * Cos(PI / 180 * (6 * I - 90)) + MidX
MinuteY = DialLength * Sin(PI / 180 * (6 * I - 90)) + MidY
PSet (MinuteX, MinuteY)
Next I
End Sub


"djebbi-farouk" a écrit
dans le message de
news:
Bonjou
je cherche comment faire une horloge inveré c'est a dire je
configuré mon
horloge avec 15 min puis lohorloge travaille de manier inveré c'est a
dir
15:00
-> 14:59 -> 15:48 .... -> 1:02 --> 00:00





merci mais mon broblem dans l'orloge inverse !!!!!!!!!


Publicité
Poster une réponse
Anonyme