码迷,mamicode.com
首页 > 其他好文 > 详细

从JPG中获取缩略图

时间:2015-05-28 12:21:38      阅读:170      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!