rotate marker using bitmap

Topics: General, Windows Forms
Jun 8, 2013 at 12:04 AM
Edited Jun 8, 2013 at 12:21 AM
i downloaded several custom markers ,but all of them had mis-locate problem in rotation
in main source i saw some code like Bearing were quoted
I'm new in this fantastic component and i don't know this problem solved or not
so i change the constructor of GMarkerGoogle to this:
    float angel;
    public GMarkerGoogle(PointLatLng p, Bitmap Bitmap,float angel=0)
         : base(p)
          this.angel = angel;
          this.Bitmap = rotateImage(Bitmap,angel);
         Size = new System.Drawing.Size(Bitmap.Width, Bitmap.Height);
         Offset = new Point(-Size.Width / 2, -Size.Height);
      private Bitmap rotateImage(Bitmap b, float angle)
          //create a new empty bitmap to hold rotated image
          Bitmap returnBitmap = new Bitmap(b.Width, b.Height);
          //make a graphics object from the empty bitmap
          Graphics g = Graphics.FromImage(returnBitmap);
          //move rotation point to center of image
          g.TranslateTransform((float)b.Width / 2, (float)b.Height / 2);
          //move image back
          g.TranslateTransform(-(float)b.Width / 2, -(float)b.Height / 2);
          //draw passed in image onto graphics object
          g.DrawImage(b, new Point(0, 0));
          return returnBitmap;