Mega Code Archive

 
Categories / C# / 2D Graphics
 

Image GetThumbnailImage

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Net; using System.IO; public class Form1 : System.Windows.Forms.Form {     [STAThread]     static void Main() {         Application.Run(new Form1());     }     protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) {         string p = "s.JPG";         Image i = Image.FromFile(p);         Image tn = i.GetThumbnailImage(50, 50, null, IntPtr.Zero);  // <=>(IntPtr)0         e.Graphics.DrawImage(tn, 100, 0, tn.Width, tn.Height);         e.Graphics.Dispose();     } }