change marker image

May 3, 2010 at 1:35 AM

hi, i want to ask how to change marker image using image from my local computer??

i did this, but the image didn't display...

 

Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports GMap.NET
Imports GMap.NET.CacheProviders
Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers

Public Class GMapMarkerImage : Inherits GMapMarker
    Dim _image As System.Drawing.Image
    Dim _point As PointLatLng

    Sub New(ByVal iPoint As PointLatLng)
        MyBase.New(iPoint)
        _point = iPoint
        _image = Image.FromFile(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) & "\atm.png")
    End Sub

    Public Overrides Sub OnRender(ByVal g As System.Drawing.Graphics)
        Dim p As New PointF(_point.Lat, _point.Lng)
        MyBase.OnRender(g)
        'g.DrawImage(_image, System.Convert.ToInt32(LocalPosition.X - Size.Width / 2), System.Convert.ToInt32(LocalPosition.Y - Size.Height / 2), Size.Width, Size.Height)
        g.DrawImage(_image, p)
    End Sub

End Class

Coordinator
May 3, 2010 at 5:36 AM

try set the Size ;}

May 3, 2010 at 6:17 AM

ohh, thank you...you are right...

May 4, 2010 at 6:28 AM
hi radioman if i want to change marker size based on zoom level, do I must load the marker with the new size from beginning??
Coordinator
May 4, 2010 at 6:41 AM

you can change it on zoom event

Aug 20, 2014 at 1:54 PM
can u give me an example to set size to 80% of its original?