当前位置:编程学习 > C#/ASP.NET >>

合成田字格

如题,我想用C#怎样把四张jpg图片合成为一张田字格的图片??
各位大哥,请帮帮忙啊!!!! --------------------编程问答-------------------- --------------------编程问答-------------------- 你是想把四张拼成一张?
--------------------编程问答-------------------- 对啊,就是这样。 --------------------编程问答-------------------- 图片合并
 private Bitmap MergerImg(Dictionary<string, Bitmap> bitMapDic)
  {
  Bitmap backgroudImg = new Bitmap(bitMapDic.Count * 12, 16);
  Graphics g = Graphics.FromImage(backgroudImg);
  g.Clear(System.Drawing.Color.White);
  int j = 0;
  foreach (KeyValuePair<string, Bitmap> entry in bitMapDic)
  {
  Bitmap map = entry.Value;
  g.DrawImage(map, j * 11, 0, map.Width, map.Height);
  j++;
  }
  g.Dispose();
  return backgroudImg;
  }  --------------------编程问答-------------------- 楼上的大哥,能否把调用方法告诉我吗??多谢!!! --------------------编程问答--------------------         private void button2_Click(object sender, EventArgs e)
        {
            Bitmap pic1 = (Bitmap)Image.FromFile(@"C:/2.jpg");
            Bitmap pic2 = (Bitmap)Image.FromFile(@"C:/2.jpg");
            Bitmap pic3 = (Bitmap)Image.FromFile(@"C:/2.jpg");
            Bitmap pic4 = (Bitmap)Image.FromFile(@"C:/2.jpg");
            Dictionary<string, Bitmap> dict = new Dictionary<string, Bitmap>();
            dict.Add("1",pic1);
            dict.Add("2", pic2);
            dict.Add("3", pic3);
            dict.Add("4", pic4);
            Bitmap bmp = MergerImg(dict);
            pictureBox1.Image = bmp;
        }
楼上的大哥,帮我看看,这样调用是否有问题???
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,