Click here to Skip to main content
15,885,869 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a list of meteors that I need to rotate individually based on their rotation speed.

VB
Private Sub Form1_Paint5(ByVal sender As Object, ByVal e As  _
        System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

        For Each I As Meteor In Meteors ' Draw and Rotate Meteors
            'Rotate I by I.Rotspeed
            e.Graphics.DrawImage(I.Type, I.Pos)
        Next
End Sub


Using another language is not an option.
Posted
Updated 29-Oct-13 6:52am
v2
Comments
Sergey Alexandrovich Kryukov 29-Oct-13 17:07pm    
Probably you mean VB.NET, not "VB". So, please tag accordingly.
—SA

1 solution

You can use System.Drawing.Graphics.Transform:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.aspx[^].

The idea is changing transform back and forth as you go from one draw primitive to be rendered to another. Optionally, you can rotate the same instance of transform Matrix back and forth. Beware of the rotation center: many out inquirers complained that their images "disappeared", but actually they simply rotated something around some off-center rotation center which moved their images out of the clip region.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900