Rotate Image

jrbarros

New member
Joined
Sep 2, 2003
Messages
1
Hi,

Im needing to rotate a image using GDI+ (RotateTransform).
Id like to know how I can rotate around a center point. How I can rotate an image and fix this inside a PictureBox (Where I can open and close the window and the picture keeps there).

Thanks...
 
This outta do it:

Code:
Dim g As Graphics = Graphics.FromHwnd(Handle)
Dim i As Integer

    For i = 0 to 360
      g.RotateTransform(i)
      g.TranslateTransform(IMG_SIZE \ 2, IMG_SIZE \ 2, Drawing2D.MatrixOrder.Append)
      g.DrawImage(bmp, IMG_SIZE \ 2, IMG_SIZE \ 2, -IMG_SIZE, -IMG_SIZE)
      g.ResetTransform
    Next i

    g.Dispose
 
Rotating GDI+ using cos/sin???

I am trying to rotate my graphic while having it move by using the Math library and not Matrixes. I have the movement code commented out becasue I was trying to figure out the rotating part.
I have three timers. One for movement, one for rotation and one for physics.

I have attached the code.
 

Attachments

Back
Top