This commit is contained in:
36
PROMS/Volian.Controls.Library/PreviewROImage.cs
Normal file
36
PROMS/Volian.Controls.Library/PreviewROImage.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
public partial class PreviewROImage : DevComponents.DotNetBar.Office2007Form //Form
|
||||
{
|
||||
public PreviewROImage(string filename, string title)
|
||||
{
|
||||
InitializeComponent();
|
||||
Image.GetThumbnailImageAbort myCallback =
|
||||
new Image.GetThumbnailImageAbort(ThumbnailCallback);
|
||||
|
||||
Bitmap bm = new Bitmap(filename); //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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user