1 //新建一个结果大图
2 Bitmap resultImg = new Bitmap(256 * xSize, 256 * ySize);
3 //获得图形画板
4 resultGraphics = Graphics.FromImage(resultImg);
5
6 //循环每张小图
7 for (i = 0; i < myRaster.Count; i++)
8 {
9 for (j = 0; j < myRaster[i].Count; j++)
10 {
11 //将小图画到大图上,
12 //后两个参数为即将要画的小图的起始位置
13 resultGraphics.DrawImage(myRaster[i][j].IMAGE, 256 * j, 256 * i);
14 }
15 }
16 //保存大图
17 resultImg.Save(filename + ".jpg");
18
19 //销毁对象
20 resultGraphics.Dispose();
21 resultImg.Dispose();
22 resultGraphics = null;
23 resultImg = null;
24
25 //调用回收器
26 GC.Collect();