using System;
using System.Drawing;
using System.Windows.Forms;
public class ThumbnailImageCreation : Form
{
public ThumbnailImageCreation()
{
this.SuspendLayout();
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(299, 273);
this.Text = "Thumbnails";
this.Paint += new System.Windows.Forms.PaintEventHandler(this.ThumbnailImageCreation_Paint);
this.Load += new System.EventHandler(this.ThumbnailImageCreation_Load);
this.ResumeLayout(false);
}
Image thumbnail;
private void ThumbnailImageCreation_Load(object sender, EventArgs e)
{
Image img = Image.FromFile("YourFile.jpg");
int thumbnailWidth = 200, thumbnailHeight = 100;
thumbnail = img.GetThumbnailImage(thumbnailWidth, thumbnailHeight,
null, IntPtr.Zero);
}
private void ThumbnailImageCreation_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(thumbnail, 10, 10);
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new ThumbnailImageCreation());
}
}