The method takes two objects - the image to crop (System.Drawing.Image) and the rectangle to crop out (System.Drawing.Rectangle). The next thing done is to create a Bitmap (System.Drawing.Bitmap) of the image. The only thing left is to crop the image. This is done by cloning the original image but only taking a rectangle of the original.

private static Image cropImage(Image img, Rectangle cropArea)
Bitmap bmpImage = new Bitmap(img);
Bitmap bmpCrop = bmpImage.Clone(cropArea,
return (Image)(bmpCrop);
創作者 王小雀 的頭像

黃臉婆--冠上夫姓了 哈

王小雀 發表在 痞客邦 留言(0) 人氣()