First design your form in like Following form
drag 1 picture box and button from ToolBox
on click event button write following Code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static Image GetThumbnailImage(string path, int width, int height)
{
using (Image image = Image.FromFile(path))
{
Image.GetThumbnailImageAbort myCallback = new Image.GetThumbnailImageAbort(ThumbnailCall);
return image.GetThumbnailImage(width, height, myCallback, IntPtr.Zero);
}
}
private static bool ThumbnailCall()
{
return false;
}
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Image = GetThumbnailImage(@"C:\Users\Administrator\Desktop\roger.jpg", 200, 200);
}
}
}
run your application ., click on load button
you will get following output..
Join the conversation! Your thoughts help the community grow.