rotating specific objects with GDI+
I'd like to rotate only one of the shapes in an animation, but the rotatetransform method applies this rotation to the whole view. I have several shapes which I want to remain stationary, and just one that should be rotated. I've been trying to use containers but so far this hasn't helped. This is visual basic on XP, using .net gdi+, system.drawing. I'm using translatetransform to establish a rotation center.
Private Sub ellipse()
myBuffer.Graphics.Clear(Color.White)
myBuffer.Graphics.TranslateTransform(200, 400)
If plus_clicked Then
myBuffer.Graphics.RotateTransform(1)
Else
myBuffer.Graphics.RotateTransform(-1)
End If
myBuffer.Graphics.DrawEllipse(P开发者_如何学JAVAens.Blue, -44, -44, 300, 300)
myBuffer.Graphics.TranslateTransform(-200, -400)
End Sub
Any ideas?
Why don't you either just keep track of what objects to draw without rotation/translation, and then draw the others on top of that?
...or...
Apply the rotation/translation, draw these objects, then reverse the rotation/translation.
...or...
Use a separate layer for the rotated/translated objects and paint them on top of the other objects.
精彩评论