GMap使用3 自定义Marker

问题1:

参考GMap使用2 的例子,使用的是google 的绿色小图钉。

现在我们要替换成我们的自定义图标怎么办呢?

我们发现GMarkerGoogle的第二个参数可以是Bitmap,我们可以直接将png图片转换成

bitmap对象来传入。代码如下

Bitmap pic = Image.FromFile("trashbin.png") as Bitmap;
GMapMarker marker = new GMarkerGoogle(p, pic);

 方法2:先把图片添加到工程的资源中去,

可以右键项目,属性,在列表中选择“资源”,添加资源。

在代码中

Bitmap icon = Properties.Resources.trashbin128;
GMapMarker marker = new GMarkerGoogle(p, icon);

问题2:

如果在地图缩放的时候,图标大小需要相应缩放。

this.gMapControl1.MouseWheel += gMapControl1_MouseWheel;

void gMapControl1_MouseWheel(object sender, MouseEventArgs e)
{
this.Text = "current zoom is" + this.gMapControl1.Zoom;
}

有用连接

制作GPS平台

https://www.cnblogs.com/yaohuimo/p/6255396.html

http://www.jt808.com/

http://www.jt808.com/?tag=gmap-net

 https://www.cnblogs.com/productivity/archive/2012/10/11/2719973.html

https://www.cnblogs.com/luxiaoxun/p/3475355.html

https://www.cnblogs.com/buptzym/archive/2011/06/05/2073236.html

http://www.cnblogs.com/luxiaoxun/p/3530341.html

原文地址:https://www.cnblogs.com/legion/p/8417871.html