Advertisement
cansik

CreateImageGrid

Dec 15th, 2011
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1.         public void CreatePictureGrid(int xRow, int yRow, int imagesize)
  2.         {
  3.             PictureBoxList = new List<PictureBox>();
  4.  
  5.             int imagecount = 0;
  6.  
  7.             for (int y = 0; y < yRow; y++)
  8.             {
  9.                 for (int x = 0; x < xRow; x++)
  10.                 {
  11.                     int xLoc = imagesize * x;
  12.                     int yLoc = imagesize * y;
  13.  
  14.                     PictureBox pbTemp = new PictureBox();
  15.  
  16.                     //PB Settings
  17.                     pbTemp.SizeMode = PictureBoxSizeMode.Zoom;
  18.                     pbTemp.Image = CreateCountImage(imagecount.ToString(), imagesize, imagesize);
  19.                     pbTemp.Width = imagesize;
  20.                     pbTemp.Height = imagesize;
  21.                     pbTemp.Location = new Point(xLoc, yLoc);
  22.  
  23.                     PictureBoxList.Add(pbTemp);
  24.                     this.pImageContainer.Controls.Add(pbTemp);
  25.  
  26.                     imagecount++;
  27.                 }
  28.             }
  29.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement