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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
Public Class Form1
Dim myGraphics As Graphics = Me.CreateGraphics
Dim myBrush As Brush
Dim BrushTab(30) As Brush 'table tampon
Dim BrushTab1(30) As Brush 'table tampon
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click, Timer2.Tick
'Construction du dessin à 30 Pies
'---------------------------------
Timer1.Enabled = False
If Timer2.Enabled = False Then
For PieNumber = 0 To 29
If PieNumber = 0 Then
myBrush = New SolidBrush(Color.Black) ' facultatif. met plus en évidence le sens de rotation
Else
If PieNumber <> 0 And PieNumber Mod (2) = 0 Then
myBrush = New SolidBrush(Color.HotPink) ' TransparencyKey ******
Else
myBrush = New SolidBrush(Color.Lime)
End If
End If
myGraphics.FillPie(myBrush, 50, 100, 180, 150, PieNumber * 12, 12)
BrushTab(PieNumber) = myBrush
Next
End If
'Animation
'---------
Timer2.Enabled = True
For PieNumber = 0 To 29
If PieNumber = 0 Then
myBrush = BrushTab(29)
BrushTab1(0) = BrushTab(0)
BrushTab(0) = BrushTab(29)
Else
myBrush = BrushTab1(PieNumber - 1)
BrushTab1(PieNumber) = BrushTab(PieNumber)
BrushTab(PieNumber) = BrushTab1(PieNumber - 1)
End If
myGraphics.FillPie(myBrush, 50, 100, 180, 150, PieNumber * 12, 12)
Next
End Sub |