我在绘制图片时遇到问题,有时会返回异常"无效参数"。这是代码:
private Image ZoomImage(Image input, Rectangle zoomArea, Rectangle sourceArea)
{
Bitmap newBmp = new Bitmap(sourceArea.Width,
sourceArea.Height,
PixelFormat.Format24bppRgb);
using (Graphics g = Graphics.FromImage(newBmp))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(input, sourceArea, zoomArea, GraphicsUnit.Pixel);
g.Dispose();
}
return newBmp;
}
我试图同时处理" g"和"输入"对象,但没有成功。我注意到当我的图像大于900px时会发生这种情况,也许它与代码无关。任何提示?