日期:2014-05-17 浏览次数:20939 次
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;
}