Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all articles
Browse latest Browse all 3384

New Post: change in position of custom marker image while zooming in and out

$
0
0
I don't know the reason.

This is my custom marker code,

public class GMapImage : GMapMarker
{
    private Image image;
    public Image Image
    {
        get
        {
            return image;
        }
        set
        {
            image = value;
            if (image != null)
            {
                this.Size = new Size(image.Width, image.Height);
            }
        }
    }

    public GMapImage(GMap.NET.PointLatLng p) : base(p)
    {
        DisableRegionCheck = true;
        IsHitTestVisible = false;
    }

    public override void OnRender(Graphics g)
    {
        if (image == null)
            return;

        g.DrawImage(image,  LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height);
    }
}
and this is how i place an image over map,
GMapImage gmimage;
gmimage = new GMapImage(new PointLatLng(latitude, longitude));
gmimage.Size = gMapControl1.Size;
var TL= gMapControl1.FromLocalToLatLng(gMapControl1.Location.X,gMapControl1.Location.Y);
gmimage.Position = TL;

gmimage.Image = bMap; // bmap is my image
transmarkers.Markers.Add(gmimage);
gMapControl1.Overlays.Add(transmarkers);

Please let me know if i am doing something wrong over here

Viewing all articles
Browse latest Browse all 3384


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>