Ben pour celui qui m'a demandé le mouvement de l'aiguille des secondes je lui file aussi le mouvement des autres aiguilles.
2 Bugs dans mon prog le redimentionnement et le fait que le mouvement se declanche par un timer
Source / Exemple :
Option Explicit
Dim Seconde, SecondeX, SecondeY, LastSecondeX, LastSecondeY As Long
Dim Minute, MinuteX, MinuteY, LastMinuteX, LastMinuteY As Long
Dim Heure, HeureX, HeureY, LastHeureX, LastHeureY As Long
Dim CenterX, CenterY As Long
Dim RayonS, RayonM, RayonH As Long
Private Sub Aiguille()
Dim SecondeX2, SecondeY2 As Long
Dim Taille As Long
'Me.Width = CenterX * 2 + CenterX / 5
'Me.Height = CenterY * 2 + CenterX / 5
For Seconde = 0 To 59
Taille = 100
If Seconde Mod 5 = 0 Then Taille = 200
SecondeX = CenterX + (RayonS + Taille) * Cos(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
SecondeY = CenterY + (RayonS + Taille) * Sin(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
SecondeX2 = CenterX + (RayonS + 20) * Cos(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
SecondeY2 = CenterY + (RayonS + 20) * Sin(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
Me.ForeColor = 0
Line (SecondeX, SecondeY)-(SecondeX2, SecondeY2)
Next
End Sub
Private Sub Form_Resize()
Me.Cls
Me.Height = Me.Width + 700
CenterX = (Me.Width - Me.Width / 10) / 2
CenterY = (Me.Height - Me.Height / 10) / 2
RayonS = CenterX - CenterX / 6
RayonM = CenterX - CenterX / 6 - CenterX / 10
RayonH = CenterX - CenterX / 6 - CenterX / 6
Aiguille
Timer1_Timer
End Sub
Private Sub Timer1_Timer()
Seconde = Val(Format(Now, "ss"))
Minute = Val(Format(Now, "nn")) * 60 + Seconde
Heure = (Val(Format(Now, "hh")) Mod 12) * 3600 + Minute
Me.Caption = Format(Now, "hh:mm:ss")
SecondeX = CenterX + RayonS * Cos(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
SecondeY = CenterY + RayonS * Sin(Seconde * 6 * 3.14 / 180 - 3.14 / 2)
MinuteX = CenterX + RayonM * Cos(Minute * 0.1 * 3.14 / 180 - 3.14 / 2)
MinuteY = CenterY + RayonM * Sin(Minute * 0.1 * 3.14 / 180 - 3.14 / 2)
HeureX = CenterX + RayonH * Cos(Heure * (1 / 120) * 3.14 / 180 - 3.14 / 2)
HeureY = CenterY + RayonH * Sin(Heure * (1 / 120) * 3.14 / 180 - 3.14 / 2)
Me.ForeColor = Me.BackColor
Line (CenterX, CenterY)-(LastSecondeX, LastSecondeY)
Line (CenterX, CenterY)-(LastMinuteX, LastMinuteY)
Line (CenterX, CenterY)-(LastHeureX, LastHeureY)
Me.ForeColor = 0
Line (CenterX, CenterY)-(SecondeX, SecondeY)
Line (CenterX, CenterY)-(MinuteX, MinuteY)
Line (CenterX, CenterY)-(HeureX, HeureY)
LastSecondeX = SecondeX
LastSecondeY = SecondeY
LastMinuteX = MinuteX
LastMinuteY = MinuteY
LastHeureX = HeureX
LastHeureY = HeureY
DoEvents
End Sub
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.