예제 #1
0
        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);
        }
예제 #2
0
 public static void LoadFromViewModel(this ImagePrinterLayer imagePrinterLayer, ImageElementViewModel imageElementEntity)
 {
     //GeoImage image = new GeoImage(imageElementEntity.SelectedImage);
     //imagePrinterLayer.Image = image;
     if (imageElementEntity.BackgroundStyle != null)
     {
         imagePrinterLayer.BackgroundMask = imageElementEntity.BackgroundStyle;
     }
     imagePrinterLayer.ResizeMode = imageElementEntity.ResizeMode;
     imagePrinterLayer.DragMode   = imageElementEntity.DragMode;
 }