private void AddLegendLayer2()
        {
            //Set the legend for the new proposal on top of the map in the upper right corner.
            LegendItem titleLegendItem = new LegendItem();

            titleLegendItem.TextStyle = new TextStyle("New Proposal", new GeoFont("Arial", 10, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem1 = new LegendItem();

            legendItem1.ImageStyle = new AreaStyle(new GeoPen(GeoColors.DarkGreen, 4), new GeoSolidBrush(GeoColors.Transparent));
            legendItem1.TextStyle  = new TextStyle("Approved", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem2 = new LegendItem();

            legendItem2.ImageStyle = new AreaStyle(new GeoPen(GeoColors.DarkRed, 4), new GeoSolidBrush(GeoColors.Transparent));
            legendItem2.TextStyle  = new TextStyle("In Discussion", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendAdornmentLayer legendAdornmentLayer = new LegendAdornmentLayer();

            legendAdornmentLayer.BackgroundMask = new AreaStyle(new GeoPen(GeoColors.Black, 1), GeoBrushes.White);
            legendAdornmentLayer.Height         = 100;
            legendAdornmentLayer.Width          = 140;

            legendAdornmentLayer.Title = titleLegendItem;
            legendAdornmentLayer.LegendItems.Add(legendItem1);
            legendAdornmentLayer.LegendItems.Add(legendItem2);

            LegendPrinterLayer legendPrinterLayer = new LegendPrinterLayer(legendAdornmentLayer);

            legendPrinterLayer.SetPosition(2, 1, 2.9, 3.9, PrintingUnit.Inch);

            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)mapView.InteractiveOverlays["PrintPreviewOverlay"];

            printerInteractiveOverlay.PrinterLayers.Add("LegendPrinterLayer2", legendPrinterLayer);
        }
예제 #2
0
        private void AddLegendLayer()
        {
            LegendItem title = new LegendItem();

            title.TextStyle = new TextStyle("Map Legend", new GeoFont("Arial", 10, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem1 = new LegendItem();

            legendItem1.ImageStyle = new AreaStyle(new GeoSolidBrush(GeoColor.FromArgb(170, GeoColors.Green)));
            legendItem1.TextStyle  = new TextStyle("Population > 70 million", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem2 = new LegendItem();

            legendItem2.ImageStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Green);
            legendItem2.TextStyle  = new TextStyle("Population < 70 million", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendAdornmentLayer legendAdornmentLayer = new LegendAdornmentLayer();

            legendAdornmentLayer.Height = 100;

            legendAdornmentLayer.Title = title;
            legendAdornmentLayer.LegendItems.Add(legendItem1);
            legendAdornmentLayer.LegendItems.Add(legendItem2);

            LegendPrinterLayer legendPrinterLayer = new LegendPrinterLayer(legendAdornmentLayer);

            legendPrinterLayer.SetPosition(2, 1, -2.9, 3.9, PrintingUnit.Inch);
            legendPrinterLayer.BackgroundMask = AreaStyle.CreateSimpleAreaStyle(new GeoColor(255, 230, 230, 230), GeoColors.Black, 1);
            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];

            printerInteractiveOverlay.PrinterLayers.Add("LegendPrinterLayer", legendPrinterLayer);
        }
        private void AddLegendLayer1()
        {
            //Set the legend for the parcel type on top of the map in the upper left corner.
            LegendItem titleLegendItem = new LegendItem();

            titleLegendItem.TextStyle = new TextStyle("Parcel Types", new GeoFont("Arial", 10, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem1 = new LegendItem();

            legendItem1.ImageStyle = new AreaStyle(new GeoPen(GeoColors.Black), new GeoSolidBrush(GeoColors.PastelGreen));
            legendItem1.TextStyle  = new TextStyle("Residential", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem2 = new LegendItem();

            legendItem2.ImageStyle = new AreaStyle(new GeoPen(GeoColors.Black), new GeoSolidBrush(GeoColors.PastelRed));
            legendItem2.TextStyle  = new TextStyle("Industrial", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendItem legendItem3 = new LegendItem();

            legendItem3.ImageStyle = new AreaStyle(new GeoPen(GeoColors.Black), new GeoSolidBrush(GeoColors.PastelBlue));
            legendItem3.TextStyle  = new TextStyle("Commerial", new GeoFont("Arial", 8), new GeoSolidBrush(GeoColors.Black));

            LegendAdornmentLayer legendAdornmentLayer = new LegendAdornmentLayer();

            legendAdornmentLayer.BackgroundMask = new AreaStyle(new GeoPen(GeoColors.Black, 1), GeoBrushes.White);
            legendAdornmentLayer.Height         = 250;
            legendAdornmentLayer.Width          = 250;

            legendAdornmentLayer.Title = titleLegendItem;
            legendAdornmentLayer.LegendItems.Add(legendItem1);
            legendAdornmentLayer.LegendItems.Add(legendItem2);
            legendAdornmentLayer.LegendItems.Add(legendItem3);

            LegendPrinterLayer legendPrinterLayer = new LegendPrinterLayer(legendAdornmentLayer);

            legendPrinterLayer.SetPosition(2, 1.2, -2.9, 3.8, PrintingUnit.Inch);

            PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)mapView.InteractiveOverlays["PrintPreviewOverlay"];

            printerInteractiveOverlay.PrinterLayers.Add("LegendPrinterLayer1", legendPrinterLayer);
        }