I am displaying my map and marker with the following code snippet.....
To my surprise, marker1.IsVisible is TRUE! I would expect it to be false once the new marker location is set. Am I not understanding how this works?
My ultimate goal is to move the marker, and if it is no longer visible in the current view, move the map so that the marker is once again centered on the map.
What am I not getting and what do I need to do different?
Chuck
gMapControl1.Position = new PointLatLng(38.497501, -120.564003);
overlayOne = new GMapOverlay(gMapControl1, "OverlayOne");
marker1 = new GMap.NET.WindowsForms.Markers.GMapMarkerGoogleRed(new PointLatLng(0, 0));
marker1.Position = new PointLatLng(38.497501, -120.564003);
overlayOne.Markers.Add(marker1);
gMapControl1.Overlays.Add(overlayOne);
That's all fine. I then click on a button to execute the following code. private void button1_Click(object sender, EventArgs e)
{
marker1.Position = new PointLatLng(38.4937, -120.582);
if (marker1.IsVisible==false)
{
MessageBox.Show("Not Visible");
gMapControl1.Position = marker1.Position;
gMapControl1.ReloadMap();
}
else MessageBox.Show("Visible");
}
The marker will move to the new location. It disappears from view, and when I drag the map to the new location, I can see the marker where I intended it to be.To my surprise, marker1.IsVisible is TRUE! I would expect it to be false once the new marker location is set. Am I not understanding how this works?
My ultimate goal is to move the marker, and if it is no longer visible in the current view, move the map so that the marker is once again centered on the map.
What am I not getting and what do I need to do different?
Chuck