happmaoo 发表于 2013-1-19 04:09:02

c#合并多个图片

private Image combineImages(List<Image> images)
{
Image image =null;
int width = 0, height = 0;
for (int i = 0; i < images.Count; i++)
{
width = tempImage.Width > width ? tempImage.Width : width;
height += tempImage.Height + 5;
}
image = new Bitmap(width, height);
Graphics g = Graphics.FromImage(image);
int offset = 0;
foreach (Image tempImage in images)
{
g.DrawImage(tempImage, new Rectangle(0, offset, tempImage.Width, tempImage.Height));
offset += tempImage.Height + 5;
}
return image;
}
页: [1]
查看完整版本: c#合并多个图片