title: C# drawimages multiple images into picturebox without tiling
body: <p>I am trying to draw multiple (20 small images or more) into a single picture box using points however when I do this it copies the top line on each line of the picture box.
  I have searched everywhere and tried many times to get this right but I cant figure it out can anyone help point me in the right direction?</p>
  
  <p>what i'm trying to accomplish is:</p>
  
  <ol>
  <li>image1  image2   image3   image4   image1</li>
  <li>image2  image4   image1   image3   image3    </li>
  <li>image4  image7   image2   image1   image6   </li>
  <li>image3  image7   image3   image7   image6</li>
  </ol>
  
  <p>however what i get is:</p>
  
  <ol>
  <li>image1  image2   image3   image4   image1</li>
  <li>image1  image2   image3   image4   image1</li>
  <li>image1  image2   image3   image4   image1 </li>
  <li>image1  image2   image3   image4   image1</li>
  </ol>
  
  <p>(without the numbers of course)
  here is the code I am using </p>
  
  <pre><code>private void Form_Load(object sender, EventArgs e)
  {
      Image[] Files = new Image[7]; 
      Bitmap a = new Bitmap(@"C:\icons\icon1.png");
      Files[0] = new Bitmap(a, 80, 80);
      image1 = Files[0];
      Bitmap b = new Bitmap(@"C:\icons\icon2.png");
      Files[1] = new Bitmap(b, 80, 80);
      image2 = Files[1];
      Bitmap c = new Bitmap(@"C:\icons\icon3.png");
      Files[2] = new Bitmap(c, 80, 80);
      image3 = Files[2];
      Bitmap d = new Bitmap(@"C:\icons\icon4.png");
      Files[3] = new Bitmap(d, 80, 80);
      image4 = Files[3];
      Bitmap h = new Bitmap(@"C:\icons\icon5.png");
      Files[4] = new Bitmap(h, 80, 80);
      image5 = Files[4];
      Bitmap f = new Bitmap(@"C:\icons\icon6.png");
      Files[5] = new Bitmap(f, 80, 80);
      image6 = Files[5];
      Bitmap g = new Bitmap(@"C:\icons\icon7.png");
      Files[6] = new Bitmap(g, 80, 80);
      image7 = Files[6];
  
      pictureBox1.BackgroundImage = CombineBitmap(Files);
  }
  
  public static System.Drawing.Bitmap CombineBitmap(Image[] files)
      {
          List&lt;System.Drawing.Bitmap&gt; images = new List&lt;System.Drawing.Bitmap&gt;();
          System.Drawing.Bitmap finalImage = null;
  
          try
          {
              int width = 0;
              int height = 0;
  
              foreach (Image image in files)
              {
                  System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(image);
  
                  width += bitmap.Width;
                  height = bitmap.Height &gt; height ? bitmap.Height : height;
  
                  images.Add(bitmap);
              }
  
              finalImage = new System.Drawing.Bitmap(width, height);
  
              using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(finalImage))
              {
                  g.Clear(System.Drawing.Color.Gray); // Change this to whatever you want the background color to be, you may set this to Color.Transparent as well
  
                  int offset = 15;
                  Point p1 = new Point(0, 0);
                  Point p2 = new Point(80, 0);
                  Point p3 = new Point(160, 0);
                  Point p4 = new Point(240, 0);
                  Point p5 = new Point(320, 0);
  
                  Point p6 = new Point(0, 80);
                  Point p7 = new Point(80, 80);
                  Point p8 = new Point(160, 80);
                  Point p9 = new Point(240, 80);
                  Point p10 = new Point(320, 80);
  
                  Point p11 = new Point(0, 160);
                  Point p12 = new Point(80, 160);
                  Point p13 = new Point(160, 160);
                  Point p14 = new Point(240, 160);
                  Point p15 = new Point(320, 160);
  
                  Point p16 = new Point(0, 240);
                  Point p17 = new Point(80, 240);
                  Point p18 = new Point(160, 240);
                  Point p19 = new Point(240, 240);
                  Point p20 = new Point(320, 240);
  
  
                  g.DrawImage(image1, p1);
                  g.DrawImage(image2, p2);
                  g.DrawImage(image3, p3);
                  g.DrawImage(image4, p4);
                  g.DrawImage(image1, p5);
  
  
                  g.DrawImage(image2, p6);
                  g.DrawImage(image4, p7);
                  g.DrawImage(image1, p8);
                  g.DrawImage(image3, p9);
                  g.DrawImage(image3, p10);
  
                  g.DrawImage(image4, p11);
                  g.DrawImage(image7, p12);
                  g.DrawImage(image2, p13);
                  g.DrawImage(image1, p14);
                  g.DrawImage(image6, p15);
  
                  g.DrawImage(image3, p16);
                  g.DrawImage(image7, p17);
                  g.DrawImage(image3, p18);
                  g.DrawImage(image7, p19);
                  g.DrawImage(image6, p20);
  
                 }
  
              return finalImage;
          }
          catch (Exception ex)
          {
              if (finalImage != null)
                  finalImage.Dispose();
  
              throw ex;
          }
          finally
          {
  
              foreach (System.Drawing.Bitmap image in images)
              {
                  image.Dispose();
              }
          }
      }
  </code></pre>