2015-05-13 88 views

回答

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);