1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| Code :
Option Explicit
Private Const diametre As Integer = 100
Private cy As Integer
Private cx As Integer
Private ancY As Single
Private ancx As Single
Private angle As Double
Private Sub Form_Activate()
Me.ScaleMode = vbPixels
Me.AutoRedraw = True
cx = Me.ScaleWidth / 2
cy = Me.ScaleHeight / 2
Me.Circle (cx, cy), diametre, vbWhite
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Dim pi As Double, toto As Double
pi = 4 * Atn(1)
toto = (angle / 180) * pi
Me.Line (cx, cy)-(ancx, ancY), Me.BackColor
ancY = cy + Sin(toto - (0.5 * pi)) * diametre
ancx = cx + Cos(toto - (0.5 * pi)) * diametre
Me.Line (cx, cy)-(ancx, ancY)
angle = angle + 1
End Sub |