我一直试图用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));
}
但是每个对象都在屏幕上旋转。我只需要将我绘制的这一个图像旋转到图片框。