使用 GDI 旋转特定对象
我只想旋转动画中的其中一个形状,但rotatetransform 方法将此旋转应用于整个视图。我有几种想要保持静止的形状,只有一种应该旋转。我一直在尝试使用容器,但到目前为止这没有帮助。这是 XP 上的 Visual Basic,使用 .net gdi+、system.drawing。我正在使用translatetransform 来建立旋转中心。
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(Pens.Blue, -44, -44, 300, 300)
myBuffer.Graphics.TranslateTransform(-200, -400)
End Sub
有什么想法吗?
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(Pens.Blue, -44, -44, 300, 300)
myBuffer.Graphics.TranslateTransform(-200, -400)
End Sub
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不直接跟踪要绘制的对象而不进行旋转/平移,然后在其之上绘制其他对象呢?
...或者...
应用旋转/平移,绘制这些对象,然后反转旋转/平移。
...或者...
对旋转/平移的对象使用单独的图层,并将它们绘制在其他对象的顶部。
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.