我在地图上显示了 1000 个标记,这些标记是从 datagridview 检索的。那工作正常,但我想在单击时在这些标记上显示文本作为客户端名称。有可能这样做吗....
if (comboBox5.SelectedIndex == 4)//(区域 1) {
gMapControl1.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance; ;
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.ServerOnly;
GMapOverlay markersOverlay = new GMapOverlay("VCS MAP");
gMapControl1.MaxZoom = 11;
gMapControl1.MinZoom = 1;
gMapControl1.Zoom = 1;
SqlDataReader myReader;
String Query = " SELECT top 200 Latitude,Longitude,client name FROM [ICPS].[dbo].[agreement latlongkir] where region ='5' ";
SqlConnection conDataBase = new SqlConnection(conString);
conDataBase.Open();
SqlCommand cmdDatabase = new SqlCommand(Query, conDataBase);
myReader = cmdDatabase.ExecuteReader();
gMapControl1.HoldInvalidation = true;
while (myReader.Read())
{
string Latitude = myReader["Latitude"].ToString();
string Longitude = myReader["Longitude"].ToString();
string ClientName = myReader["client name"].ToString();
gMapControl1.Position = new PointLatLng(float.Parse(Latitude), float.Parse(Longitude));
GMarkerGoogle marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.pink);
markersOverlay.Markers.Add(marker);
gMapControl1.Overlays.Add(markersOverlay);
marker.ToolTip = new GMapRoundedToolTip(marker);
marker.ToolTipText = myReader("ClientName");
}
}