🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: free.it.visual-basic
Article #132

Problema Classe Matrix AtRotate

#132
From: DeskDeck
Date: Mon, 15 Mar 2010 12:54
89 lines
4219 bytes
Salve..
Vorrei sapere se quache d'uno mi puo aiutare...
Sto cercando di programmare un nuovo controllo
che mi deve dare un effetto grafico di rotazione.
Sono riuscito a costrire il controllo in base a cio che
mi ero prefissato, ma adesso non riesco a dargli un effetto
di movimento di rotazione...
Se provo a farlo ruotare con una proprieta timer
non riesco a farlo...rimane fermo (mi ruota solo i bordi)

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...
Technical Details
Message-ID: <4b9e2e1d$0$827$4fafbaef@reader5.news.tin.it>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!feeder.news.tin.it!spool.news.tin.it!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f94ee,131b971738d46b27,start
X-Google-NewGroupId: yes
X-Google-Attributes: gid3de4ef2fba,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!feeder.news.tin.it!spool.news.tin.it!not-for-mail
Date: Mon, 15 Mar 2010 13:54:52 +0100
From: DeskDeck <mecdeck@alice.it>
Reply-To: mecdeck@alice.it
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
Newsgroups: free.it.visual-basic
Subject: Problema Classe Matrix AtRotate
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 89
Message-ID: <4b9e2e1d$0$827$4fafbaef@reader5.news.tin.it>
Organization: TIN.IT (http://www.tin.it)
X-Comments: Please send technical notifications to newsmaster@tin.it
NNTP-Posting-Host: 87.3.92.217
X-Trace: 1268657693 reader5.news.tin.it 827 87.3.92.217:7563
X-Complaints-To: Please send abuse reports to abuse@retail.telecomitalia.it