vi posto il codice...
-----------------------
Imports System.Drawing.Drawing2D
'**************************
Public Class CntrlRuota
'******** Campi
Public MyTime As Timer
Private AngleRotate As Integer = 0
'******** Contruttore
Sub New()
'------------------
InitializeComponent()
'------------------ Setto il controllo
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
'------------------- Timer
MyTime = New Timer
AddHandler MyTime.Tick, AddressOf TickMyTime
'------------------
End Sub
'******** Evento Tick del Timer
Private Sub TickMyTime(ByVal sender As Object, ByVal e As _
System.EventArgs)
'------------------
MyTime.Interval = 50
'----
If AngleRotate >= 360 Then
AngleRotate = 0
Else
AngleRotate += 10
End If
'------------------
Me.Refresh()
'------------------
End Sub
'********* Procedura Paint
Private Sub CntrlRuota_Paint(ByVal sender As Object, ByVal e As _
System.Windows.Forms.PaintEventArgs) Handles Me.Paint
'-------------------
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
'-------------------
Dim Mx1 As New Matrix
'-------------------
Mx1.RotateAt(AngleRotate, New Point(Me.Width / 2, Me.Height / 2))
'-------------------
Dim R As New Rectangle(Me.Width - 12, (Me.Height / 2) - 12, 10, 10)
'-------------------
Dim MyStep As Integer = 9
'-------------------
For i As Integer = 0 To 360 Step MyStep
'------
Dim Mx2 As New Matrix
'------
Mx2.RotateAt(i, New Point(Me.Width / 2, Me.Height / 2))
e.Graphics.Transform = Mx2
'------
'e.Graphics.DrawEllipse(Pens.Blue, R)
e.Graphics.DrawLine(Pens.Brown, CInt(Me.Width / 2), 0,
CInt(Me.Width / 2), CInt(Me.Height / 2) - 60)
'------
Next
'--------------------
e.Graphics.Transform = Mx1
'--------------------
e.Graphics.DrawRectangle(Pens.Blue, New Rectangle(0, 0,
Me.Width - 1, Me.Height - 1))
'--------------------
End Sub
End Class
'-----------------------
Se qualche d'uno vuole analizzare il codice
e se mi puo indicare dove sbaglio...
Per provare il controllo bisogna naturalemte attivare a true la
proprieta enable del timer
Grazie...