首页 > 其他 > 详细

从JPG中获取缩略图

时间:2015-05-28 12:21:03      阅读:264      评论:0      收藏:0      [点我收藏+]
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();
        }
    }
}

 

从JPG中获取缩略图

原文:http://www.cnblogs.com/sdikerdong/p/4535438.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!