private void btnGenerateEmf_Click(object sender, EventArgs e) { ShapeFileFeatureLayer countryLayer = mapEngine.StaticLayers["countryLayer"] as ShapeFileFeatureLayer; RectangleShape frame = new RectangleShape(0, 80, 40, 0); Rectangle rect = ExtentHelper.ToScreenCoordinate(mapEngine.CurrentExtent, frame, map.Width, map.Height); Metafile metaFile = new Metafile("result.emf", Graphics.FromImage(new Bitmap(1, 1)).GetHdc(), rect, MetafileFrameUnit.Pixel); GraphicsGeoCanvas graphicGeoCanvas = new GraphicsGeoCanvas(); Graphics graphic = Graphics.FromImage(metaFile); graphicGeoCanvas.ClippingArea = frame; countryLayer.Open(); graphicGeoCanvas.BeginDrawing(graphic, map.Width, map.Height, mapEngine.CurrentExtent, GeographyUnit.DecimalDegree); countryLayer.Draw(graphicGeoCanvas, new System.Collections.ObjectModel.Collection()); graphicGeoCanvas.EndDrawing(); countryLayer.Close(); metaFile.Dispose(); MessageBox.Show(String.Format("The map has been saved as EMF to {0}\\{1}", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "result.emf")); }