private void SetLayerProperties() { GeoImage image = new GeoImage(txtPath.Text); imagePrinterLayer.Image = image; imagePrinterLayer.Open(); PointShape centerPoint = imagePrinterLayer.GetPosition().GetCenterPoint(); imagePrinterLayer.SetPosition(image.Width, image.Height, centerPoint, PrintingUnit.Point); }
private void AddLogoImage() { //Load the image to a GeoImage and then create the ImagePrinterLayer using that image GeoImage compassGeoImage = new GeoImage(@"..\..\..\Resources\Compass.png"); ImagePrinterLayer imagePrinterLayer = new ImagePrinterLayer(compassGeoImage); // Set the imagePrinterLayer position offset from the page center and .75 inches wide and .75 inches tall RectangleShape pageBoundingbox = GetPageBoundingBox(PrintingUnit.Inch); imagePrinterLayer.SetPosition(.75, .75, pageBoundingbox.GetCenterPoint().X + 3.5, pageBoundingbox.GetCenterPoint().Y - 2.0, PrintingUnit.Inch); // Add the imagePrinterLayer to the PrinterInteractiveOverlay PrinterInteractiveOverlay printerInteractiveOverlay = (PrinterInteractiveOverlay)mapView.InteractiveOverlays["PrintPreviewOverlay"]; printerInteractiveOverlay.PrinterLayers.Add("ImageLayer", imagePrinterLayer); }
internal static PrinterLayer GetImagePrinterLayer(double width, double height, double centerX, double centerY) { ImageElementViewModel imageEntity = new ImageElementViewModel(); GeoImage geoImage = null; geoImage = new GeoImage(new MemoryStream(imageEntity.SelectedImage)); ImagePrinterLayer imagePrinterLayer = new ImagePrinterLayer(geoImage, 0, 0, PrintingUnit.Inch) { DrawingExceptionMode = DrawingExceptionMode.DrawException }; imagePrinterLayer.LoadFromViewModel(imageEntity); var imgWidth = imagePrinterLayer.Image.Width; var imgHeight = imagePrinterLayer.Image.Height; imagePrinterLayer.Open(); imagePrinterLayer.SetPosition(width, height, centerX, centerY, PrintingUnit.Inch); return(imagePrinterLayer); }