帮忙看下我这样写的扩展方法为什么点不出来?
using System;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.IO;
namespace System
{
public static class ImageExtensions
{
public static Image GetThumbImageByWidth(this Image original, int nwidth)
{
if (original.Width < nwidth)
return original;
else
{
var width = 0; var height = 0;
float scale = (float)nwidth / original.Width;
width = nwidth;
height = (int)Math.Round(original.Height * scale);
var bitmap = new Bitmap(width, height);
var g = Graphics.FromImage(bitmap);
g.DrawImage(original, 0, 0, width, height);
g.SmoothingMode = SmoothingMode.HighQuality;
return bitmap;
}
}
}
}