Beispiel #1
0
        private void btnZoomOut_Click(object sender, RoutedEventArgs e)
        {
            // Grab the MapPrinterLayer and adjust the extent
            PrinterInteractiveOverlay printerOverlay  = (PrinterInteractiveOverlay)Map1.InteractiveOverlays["PrintPreviewOverlay"];
            MapPrinterLayer           mapPrinterLayer = ((MapPrinterLayer)(printerOverlay.PrinterLayers["MapLayer"]));

            // Here we snap the current scale to the default zoomLevelSet when we zoom in
            ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
            double       newScale     = ZoomLevelSet.GetHigherZoomLevelScale(MapUtil.GetScale(mapPrinterLayer.MapExtent, (float)mapPrinterLayer.GetBoundingBox().Width, mapPrinterLayer.MapUnit), zoomLevelSet);

            mapPrinterLayer.MapExtent = MapUtil.ZoomToScale(newScale, mapPrinterLayer.MapExtent, mapPrinterLayer.MapUnit, (float)mapPrinterLayer.GetBoundingBox().Width, (float)mapPrinterLayer.GetBoundingBox().Height);

            Map1.Refresh();
        }