我在 GMap 上有一个标记(飞机错误),它在飞行路径上移动,但我希望它在转弯时旋转。在 GMap C# 中有什么方法可以做到这一点吗?
最佳答案
您可以使用此功能旋转标记的图像,然后用该图像重新指定标记。
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);
关于c# - 如何旋转自定义移动标记(图像)GMap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30223382/