Custom markers

Jan 22, 2009 at 10:38 AM
Thanks radioman for the FromLocalToLatLong method.!

I see that all your markers are compiled in the control. It would be nice to be able to add custom markers.

Maybe you could just add an CustomImage property in the Marker class of type System.Drawing.Bitmap that would be handled in the GMapControl.Drawmarker, something like:


foreach(Marker m in markers)




Point p = Manager.FromLatLngToPixel(m.Position, Zoom);




if(m.Visible && this.Region.IsVisible(p))



    if (marker.CustomImage != null)
        switch (m.Type)
Jan 22, 2009 at 10:42 AM
welcome, good idea!
Jan 22, 2009 at 10:50 AM
..where to set custom image center? ..with google markers i set it to middle bottom
Jan 22, 2009 at 10:51 AM
Jan 22, 2009 at 10:54 AM
okey ;}
Jan 22, 2009 at 11:08 AM
done, can you test it, if all aligment modes is good?
Jan 22, 2009 at 11:31 AM
Thanks, works for me! I'll do a some more testing later and let you know if there are any problems.
Jan 22, 2009 at 11:42 AM
Jan 22, 2009 at 1:13 PM
Well, almost ok. You missed the tooltip in the DrawMarkers for the CustomMarker.

I think you could place the switch(m.Mode) outside of the switch(m.Type) not to repeat the code.

Also it'd be nice to have the method drawSimpleToolTip marked as virtua in order to customize.
Jan 22, 2009 at 7:36 PM
i'm not missed, it's just not complete, because custom markers have custom size with custom center aligment, so there is need for some calculations before drawing...

good point about virtual DrawSimpleToolTip!
Jan 24, 2009 at 12:50 PM