public void AddMarkerOne(double Lat, double Lng, string tooltip, MarkerCustomType type) { if (this.Overlays.Count == 0) { this.Overlays.Add(new GMapOverlay()); } OverlayCustom = this.Overlays[0]; var marker = OverlayCustom.Markers.FirstOrDefault( p => p is GMapMarkerCustomType && p.As <GMapMarkerCustomType>().Type == type); if (marker == null) { marker = new GMapMarkerCustomType(new PointLatLng(Lat, Lng), type); marker.ToolTipText = tooltip; marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; OverlayCustom.Markers.Add(marker); } else { marker.ToolTipText = tooltip; marker.ToolTipMode = MarkerTooltipMode.OnMouseOver; marker.Position = new PointLatLng(Lat, Lng); } if (IsPosition) { this.Position = marker.Position; } MarkerCustomer = marker; }
public GMapMarkerCustomType(PointLatLng p, MarkerCustomType type) : base(p) { this.Size = new Size(23, 30); Type = type; switch (type) { case MarkerCustomType.A: Icon = Properties.Resources.STaxi_MarkerA; break; case MarkerCustomType.B: Icon = Properties.Resources.Staxi_MarkerB_Green; break; case MarkerCustomType.C: Icon = Properties.Resources.Staxi_MarkerC_Yellow; break; case MarkerCustomType.D: Icon = Properties.Resources.Staxi_MarkerD_Red; break; case MarkerCustomType.Custom: Icon = Properties.Resources.markerMG; break; case MarkerCustomType.None: Icon = Properties.Resources.icong; break; case MarkerCustomType.Flag: Icon = Properties.Resources.Marker18; break; case MarkerCustomType.Chartreuse: Icon = ResizeImage(Properties.Resources.icon_Map_Chartreuse, this.Size); break; case MarkerCustomType.Pink: Icon = ResizeImage(Properties.Resources.icon_Map_Pink, this.Size); break; case MarkerCustomType.GPS: Icon = Properties.Resources.red_marker_32; break; case MarkerCustomType.PMDH: Icon = Resources.marker_32; break; } }
public void AddMarker_2(double Lat, double Lng, string tooltip, MarkerCustomType type, MarkerTooltipMode mode = MarkerTooltipMode.Always, string title = "") { if (this.Overlays.Count == 0) { this.Overlays.Add(new GMapOverlay()); } OverlayCustom = this.Overlays[0]; //this.Overlays.Add(OverlayCustom); var marker = new GMapMarkerCustomType(new PointLatLng(Lat, Lng), type); marker.ToolTipText = tooltip; marker.ToolTipMode = mode; marker.Title = title; OverlayCustom.Markers.Add(marker); MarkerCustomer = marker; if (IsPosition) { this.Position = marker.Position; } }