我一直在尝试用 C# GDI+ 制作游戏。为此,我希望图像沿其移动方向旋转。
public Point PlayerPosition = new Point(320, 240);
public int PlayerDirection = 90;
public Bitmap PlayerImage;
PlayerImage = new Bitmap(Application.StartupPath + "\\Drake.png");
public void DrawPlayer(Graphics g)
{
Matrix rotMatrix = new Matrix();
rotMatrix.RotateAt((float)PlayerDirection, new PointF(PlayerPosition.X-17, (float)PlayerPosition.Y-27), MatrixOrder.Prepend);
g.Transform = rotMatrix;
g.DrawImage(PlayerImage , new Point(PlayerPosition.X-33,PlayerPosition.Y-70));
}
但是每个对象都在屏幕上旋转。我只需要将我绘制的这张图片旋转到图片框。