Exemple #1
0
		public IBaseExportColumn CreateExportColumn()
		{
			BaseStyleDecorator st = this.CreateItemStyle();
			ExportImage item = new ExportImage(st);
			
			if (this.Image == null) {
				item.FileName = this.imageFileName;
				this.Image = this.LoadImage();
			}
			
			item.Image = this.Image;
			item.ScaleImageToSize = this.ScaleImageToSize;
			return item;
		}
		static System.Windows.Media.Imaging.BitmapImage BitmapFromImage(ExportImage image)
		{
			var bitmap = new System.Windows.Media.Imaging.BitmapImage();
			bitmap.BeginInit();
			MemoryStream memoryStream = new MemoryStream();
			image.Image.Save(memoryStream, ImageFormat.Bmp);
			memoryStream.Seek(0, System.IO.SeekOrigin.Begin);
			bitmap.StreamSource = memoryStream;
			bitmap.EndInit();
			return bitmap;
		}
		UIElement CreateImageColumn(ExportImage exportImage)
		{
			System.Windows.Media.Imaging.BitmapImage bitmap = BitmapFromImage(exportImage);
			Image image = new Image();
			image.Source = bitmap;
			SetDimension(image,exportImage.StyleDecorator);
			image.Stretch = System.Windows.Media.Stretch.Fill;
			return image;
		}