我在 GMap 上有一个标记(平面错误),它在飞行路径上移动,但我希望它在转弯时旋转。在 GMap C# 中有什么方法可以做到这一点吗?
问问题
1449 次
1 回答
2
您可以使用此功能旋转标记的图像,然后使用此图像重新标记标记。
public Bitmap RotateImage(Image image, float angle)
{
Bitmap rotatedBmp = new Bitmap(image.Width, image.Height);
rotatedBmp.SetResolution(image.HorizontalResolution, image.VerticalResolution);
Graphics g = Graphics.FromImage(rotatedBmp);
PointF offset = new PointF(image.Width / 2, image.Height / 2);
g.TranslateTransform(offset.X, offset.Y);
g.RotateTransform(angle);
g.TranslateTransform(-offset.X, -offset.Y);
g.DrawImage(image, new PointF(0, 0));
return rotatedBmp;
}
你可以这样做
marker.img = RotateImage(innitialImg, xxx);
于 2015-06-04T05:48:22.703 回答