从JPG中获取缩略图

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

using System.Net;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        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();
        }
    }
}
原文地址:https://www.cnblogs.com/sdikerdong/p/4535438.html