Hi,
I'm tring to save bitmap of a map but I have problem with it. When I try to save the bitmap, I got just the overlay but not the WMSLayer. But without the saving bitmap, it displays fine.
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
Map1.CurrentExtent = new RectangleShape(-125, 72, 50, -46);
Map1.MapUnit = GeographyUnit.DecimalDegree;
WorldMapKitWmsWebOverlay worldMapKitWmsWebOverlay = new WorldMapKitWmsWebOverlay();
Map1.CustomOverlays.Add(worldMapKitWmsWebOverlay);
ShapeFileFeatureLayer zipLayer = new ShapeFileFeatureLayer(ConfigurationSettings.AppSettings["Default2"] + "\\tl_2010_26_zcta510.shp");
zipLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
zipLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("ZCTA5CE10", new GeoFont("Verdana", 7, DrawingFontStyles.Regular), new GeoSolidBrush(GeoColor.StandardColors.LightSlateGray));
zipLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryFeatureLayer selectedZipLayer = new InMemoryFeatureLayer();
selectedZipLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.LightGreen, GeoColor.GeographicColors.Sand, 2);
selectedZipLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Country1("ZCTA5CE10");
selectedZipLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
selectedZipLayer.DrawingMarginPercentage = 50;
selectedZipLayer.InternalFeatures.Clear();
zipLayer.Open();
Feature features = zipLayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "49508")[0];
Feature features2 = zipLayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "49512")[0];
Feature features3 = zipLayer.QueryTools.GetFeaturesByColumnValue("ZCTA5CE10", "49323")[0];
zipLayer.Close();
InMemoryFeatureLayer CircleLayer = new InMemoryFeatureLayer();
CircleLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.SimpleColors.DarkOrange, 2);
CircleLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Country1("ZCTA5CE10");
CircleLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
CircleLayer.DrawingMarginPercentage = 50;
PointShape pointInEquator = new PointShape(double.Parse("0", CultureInfo.InvariantCulture), double.Parse("0", CultureInfo.InvariantCulture));
EllipseShape cir = new EllipseShape(pointInEquator, 20, 20, Map1.MapUnit, DistanceUnit.Mile);
cir.TranslateByOffset(-85.6680556, 42.9633333);
CircleLayer.InternalFeatures.Add(new Feature(cir));
selectedZipLayer.InternalFeatures.Add("49508", features);
selectedZipLayer.InternalFeatures.Add("49512", features2);
selectedZipLayer.InternalFeatures.Add("49323", features3);
LayerOverlay staticOverlay = new LayerOverlay("StaticOverlay");
staticOverlay.IsBaseOverlay = false;
staticOverlay.Layers.Add("ZipLayer", zipLayer);
Map1.CustomOverlays.Add(staticOverlay);
LayerOverlay dynamicOverlay = new LayerOverlay("DynamicOverlay");
dynamicOverlay.IsBaseOverlay = false;
dynamicOverlay.TileType = TileType.SingleTile;
dynamicOverlay.Layers.Add("HighlightLayer", selectedZipLayer);
dynamicOverlay.Layers.Add("Highlight2Layer", CircleLayer);
Map1.CustomOverlays.Add(dynamicOverlay);
if (selectedZipLayer.InternalFeatures.Count > 1)
{
selectedZipLayer.Open();
RectangleShape zipRect = selectedZipLayer.GetBoundingBox();
Map1.CurrentExtent = selectedZipLayer.GetBoundingBox();
selectedZipLayer.Close();
CircleLayer.Open();
RectangleShape cirRect = CircleLayer.GetBoundingBox();
//Map1.CurrentExtent = CircleLayer.GetBoundingBox();
CircleLayer.Close();
string str = zipRect.GetWellKnownText();
PolygonShape ps = new PolygonShape(str);
Map1.CurrentExtent.ExpandToInclude(cir);
selectedZipLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(50, GeoColor.StandardColors.Green);
((LayerOverlay)Map1.CustomOverlays[1]).Redraw();
((LayerOverlay)Map1.CustomOverlays[2]).Redraw();
}
Bitmap bmp = Map1.GetBitmap(400, 400);
bmp.Save(@"C:\Users\vvu\Desktop\New folder (2)\CSharp\CSWebEditionSample\bin\c.png");