如何编写将在C#中裁剪图像的应用程序?
您可以用来Graphics.DrawImage从位图将裁剪的图像绘制到图形对象上。
Graphics.DrawImage
Rectangle cropRect = new Rectangle(...); Bitmap src = Image.FromFile(fileName) as Bitmap; Bitmap target = new Bitmap(cropRect.Width, cropRect.Height); using(Graphics g = Graphics.FromImage(target)) { g.DrawImage(src, new Rectangle(0, 0, target.Width, target.Height), cropRect, GraphicsUnit.Pixel); }