Bitmap bitmap = new Bitmap(m_aTiles[i].bitmap.Width, m_aTiles[i].bitmap.Height);
Graphics g1 = Graphics.FromImage(bitmap); //创建个g1的Graphics
if (i % 2 == 0)
g1.FillRectangle(Brushes.Red, new Rectangle(0, 0, rectCurTile.X - m_rectScope.X, rectCurTile.Y - m_rectScope.Y)); //把b1涂成红色
else
g1.FillRectangle(Brushes.Blue, new Rectangle(0, 0, rectCurTile.X - m_rectScope.X, rectCurTile.Y - m_rectScope.Y)); //把b1涂成红色
e.Graphics.DrawImage(bitmap, rectCurTile.X - m_rectScope.X, rectCurTile.Y - m_rectScope.Y);
string path = AppDomain.CurrentDomain.BaseDirectory + "\\Images\\" + i + ".tiff";
bitmap.Save(path);
创建一个Bitmap位图,构造中会传递一个高度和宽度;
创建一个Graphics对象;
判断当前取模运算,绘制一个矩形框并填充颜色,根据起点坐标和宽高;
最后画在Bitmap图片上面;
保存图片;