If I am not making any mistake on your question, the problem is it seems impossible cannot hide all the overlays because this problem is always happening when you are trying to make the last overlay invisible.
Following code is a very small sample code showing to hide all the overlays when click on the check box, can you have a try on it? private void ShowHideLayer_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
Thanks for your example, which helps us a lot to find out what the problem is. Following is a couple of solutions for you. Solution1: Me.WinformsMap1.ThreadingMode = ThinkGeo.MapSuite.DesktopEdition.MapThreadingMode.SingleThreaded
Private Sub cmdChangeOverlayVisibilty_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdChangeOverlayVisibilty.Click
WinformsMap1.Overlays(0).IsVisible = Not WinformsMap1.Overlays(0).IsVisible WinformsMap1.Refresh()
thanks for information. Solution seems to be the right one because we use map in mutithread mode.
But as I understand if you call overload of WinformsMap.Refresh (Refresh(Overlay)) any kind of TileCache is also cleared. This is not what I want. I only want to hide my overlay. If user activates overlay again the map control can load data from cache.
Can you also give me some more information on locking. I have read a lot in the forum but it is not clear at all when I have to use it.
Yes, that is true when you passed in the overlays to be redrawn those overlays caches will be cleared, if you really do not want to do this, just change the FileBitmapTile cache directory and then changed back when needed.
About the Lock system, it will only need to be considered in Multi-threaded mode to fix the threading problem. In single threaded mode, just forget it. Also, we have video talking something in depth in the DevelopBlog about the lock stuff, if you are interested, just take a look.