I'm at a loss how to get my map to display when my form loads. I am using a GdiPlusRasterLayer. I add the layer to a layer overlay and add the overlay to the map. Then I try calling the Refresh method on the map and the raster image does not display. I have to manually zoom in, zoom out or resize the form before the image displays. I've tried:
WinformsMap.Refresh()
WinformsMap.Refresh(WinformsMap.Overlays[0])
even
GdiPlusRasterOverlay rasterOverlay = new GdiPlusRasterOverlay(fileName);
rasterOverlay.Lock.IsDirty = true;
rasterOverlay.IsVisible = true;
etc.
Nonetheless, the map does not display until I manually move or zoom the map. I am using Desktop Edition 4.0, .NET framework 3.5 an VS2010.
Just make sure you have set the MapUnit and CurrentExtent for the map control correctly? We have a HowDoI sample loading a Tif file, in which you can simple replace the GeoTiffRasterlayer into GdiPlusRasterlayer, could you have a try to see if this problem exists? HowDoI\Satellite Image\Load a GeoTiff image
Any more questions please feel free to let me know.
I think I’ve isolated the cause. I am dynamically adding a user control to a panel. The user control contains a Winforms map. When I set the docking style, the map does not display when the control is loaded. The other controls on the user control display, however.
If I set the anchor properties to Top, Left, Bottom and Right, and avoid using the docking style, the map will display on the user control when the user control loads.
This is a “good enough” work-around for me, so no worries.