change marker image

May 3, 2010 at 2: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)
        _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)
        '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

May 3, 2010 at 6:36 AM

try set the Size ;}

May 3, 2010 at 7:17 AM

ohh, thank are right...

May 4, 2010 at 7: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??
May 4, 2010 at 7:41 AM

you can change it on zoom event

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