这就是场景,假设我有两个图片盒。 pbSrc 显示源图像, pbCrop 显示裁剪后的图像。我的代码显示了从 pbSrc 到 pbCrop 的裁剪图像。我试着保存它,但输出并不像我期望的那样:(((
pbCrop.Refresh();
//Prepare a new Bitmap on which the cropped image will be drawn
Bitmap sourceBitmap = new Bitmap(pbSrc.Image, pbSrc.Width, pbSrc.Height);
Graphics a = pbCrop.CreateGraphics();
//Draw the image on the Graphics object with the new dimesions
a.DrawImage(sourceBitmap, new Rectangle(0, 0, pbCrop.Width, pbCrop.Height), rectCropArea, GraphicsUnit.Pixel);
a.Save(); //Not sure if this really does saves the image into a file :v