private void AddMarkers(GMapOverlay overlay, List <NearByResult> points) { mainMarker = new GMapMarkerWithLabel( new PointLatLng(coord.Latitude, coord.Longitude), GMarkerGoogleType.red, "目前位置", Color.Red); overlay.Markers.Add(mainMarker); for (int i = 0; i < points.Count; i++) { PointLatLng point = new PointLatLng(points[i].Geometry.Location.Latitude, points[i].Geometry.Location.Longitude); GMapMarkerWithLabel marker = new GMapMarkerWithLabel(point, GMarkerGoogleType.green, points[i].Name, Color.Green); marker.ToolTipText = "\n" + points[i].Name; marker.ToolTip.TextPadding = new Size((int)marker.ToolTip.Font.Height, (int)marker.ToolTip.Font.Height); overlay.Markers.Add(marker); } overlay.IsVisibile = false; overlay.IsVisibile = true; }
//todo private void gMapControl1_OnMapZoomChanged() { this.overlayTwo.SetZoomLevel(this.gMapControl1.Zoom); if (this.gMapControl1.Zoom == 18) { for (int i = 0; i < overlayOne.Markers.Count; i++) { GMapMarkerWithLabel marker = overlayOne.Markers[i] as GMapMarkerWithLabel; //marker.SetZoomLevel(this.gMapControl1.Zoom); marker.ToolTipMode = MarkerTooltipMode.Never; } } else { for (int i = 0; i < overlayOne.Markers.Count; i++) { GMapMarkerWithLabel marker = overlayOne.Markers[i] as GMapMarkerWithLabel; //marker.SetZoomLevel(this.gMapControl1.Zoom); marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; } } }