日期:2014-05-20 浏览次数:20973 次
Graphics g = System.Drawing.Graphics.FromImage(ReducedImage);
// 设置画布的描绘质量
g.CompositingQuality = CompositingQuality.HighQuality;
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
private static Image CutPicture(int X, int Y, int Width, int Height, Image image)
{
if (image.Width < X + Width
------解决方案--------------------
image.Height < Y + Height)
{
MessageBox.Show("截取的区域超过了图片本身的高度、宽度", "错误!", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
Bitmap Bmp = new Bitmap(image);
Rectangle cloneRect = new Rectangle(X, Y, Width, Height);
Bitmap cloneBmp = Bmp.Clone(cloneRect, Bmp.PixelFormat);
return cloneBmp;
}