title: Add panel dynamically c#
body: <p>I'm trying to add panels to groupbox, the panels will have a backgroundimage.</p>
  
  <p>I have three files, so I should have 3 panels in the groupbox, but 4 panels be  displayed with the same photo . I am using the following code:</p>
  
  <pre><code>DirectoryInfo di = new DirectoryInfo(folder);
          FileInfo[] rgFiles = di.GetFiles();
          Point NewPosition =new Point() ;
  
          foreach (FileInfo fi in rgFiles)
          {
              Bitmap b = new Bitmap(folder+@"\"+ fi.Name);
  
              Panel p = new Panel();
              p.Size = b.Size;
              p.BackgroundImage = b;
              p.Name = fi.Name;
              p.Dock = DockStyle.Top;
  
  
  
              control.Controls.Add(p);
  
          }
  </code></pre>
  
  <p>Any suggestions please.</p>