38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.ComponentModel;
 | |
| using System.Data;
 | |
| using System.Drawing;
 | |
| using System.Text;
 | |
| using System.Windows.Forms;
 | |
| using System.IO;
 | |
| 
 | |
| namespace Volian.Controls.Library
 | |
| {
 | |
| 	public partial class PreviewROImage : DevComponents.DotNetBar.Office2007Form //Form
 | |
| 	{
 | |
| 		public PreviewROImage(byte [] image, string title)
 | |
| 		{
 | |
| 			InitializeComponent();
 | |
| 			Image.GetThumbnailImageAbort myCallback =
 | |
| 				new Image.GetThumbnailImageAbort(ThumbnailCallback);
 | |
| 			
 | |
| 			MemoryStream ms = new MemoryStream(image);
 | |
| 			Bitmap bm = new Bitmap(ms); //Bitmap(filename);
 | |
| 			SizeF sizef = new SizeF(bm.Width / bm.HorizontalResolution,
 | |
| 										bm.Height / bm.VerticalResolution);
 | |
| 			// 747 & 535 is the size of the image window (roImage).
 | |
| 			float fscale = Math.Min(747 / sizef.Width, 535 / sizef.Height);
 | |
| 			sizef.Width *= fscale;
 | |
| 			sizef.Height *= fscale;
 | |
| 			Image thmb = bm.GetThumbnailImage((int)sizef.Width, (int)sizef.Height, myCallback, IntPtr.Zero);
 | |
| 
 | |
| 			this.roImage.Image = thmb;
 | |
| 			this.Text = title;
 | |
| 		}
 | |
| 		public bool ThumbnailCallback()
 | |
| 		{
 | |
| 			return false;
 | |
| 		}
 | |
| 	}
 | |
| } |