Hi
I'm calculating an countour map in runtime, and insert this, sometimes when inserting the overlay and making refresh, the bitmap is not drawn, first when forcing the map by zoom/pan.
Some code snipes:
When new bitmap is inserted, i use the following code, to release the old one. (works fine)
if (winMap.Overlays[1].Name == "GdiLayer")
{
winMap.Overlays[1].Lock.EnterWriteLock();
try
{
GdiPlusRasterLayer a = (GdiPlusRasterLayer)winMap.FindRasterLayer("GdiLayer");
if (a != null)
{
a.Close();
a.IsVisible = false;
File.Delete(a.PathFilename);
}
}
finally
{
winMap.Overlays[1].Lock.ExitWriteLock();
}
winMap.Overlays.RemoveAt(1);
winMap.Refresh();
}
Code for inserting overlay
bm.Save(filename, ImageFormat.Png);
GdiPlusRasterLayer gdiLayer = new GdiPlusRasterLayer(filename, winMap.CurrentExtent);
gdiLayer.UpperThreshold = double.MaxValue;
gdiLayer.LowerThreshold = 0;
gdiLayer.Transparency = 185;
LayerOverlay imageOverlay = new LayerOverlay();
imageOverlay.Layers.Add("GdiLayer", gdiLayer);
imageOverlay.Name = "GdiLayer";
winMap.Overlays.Insert(1, imageOverlay);
winMap.Refresh();