Advertisement
Guest User

Untitled

a guest
Jan 29th, 2015
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1.  
  2. int picbox;
  3. PictureBox pic = new PictureBox();
  4. pic.Height = 40;
  5. pic.Width = 40;
  6. pic.Top = rnd.Next(0, this.Height - 150);
  7. pic.Left = rnd.Next(0, this.Width - 130);
  8. pic.SizeMode = PictureBoxSizeMode.StretchImage;
  9. this.Controls.Add(pic);
  10. picbox = rnd.Next(1, 4);
  11. if (picbox == 1)
  12. {
  13. pic.Image = Image.FromFile(Application.StartupPath + @"/../../images/image1.jpg");
  14. pic.Tag = "1";
  15. }
  16. else if (picbox == 2)
  17. {
  18.  
  19. pic.Image = Image.FromFile(Application.StartupPath + @"/../../images/image2.jpg");
  20. pic.Tag = "2";
  21. }
  22. else if (picbox == 3)
  23. {
  24. pic.Image = Image.FromFile(Application.StartupPath + @"/../../images/image3.jpg");
  25. pic.Tag = "3";
  26. }
  27. else if (picbox == 4)
  28. {
  29. pic.Image = Image.FromFile(Application.StartupPath + @"/../../images/image4.jpg");
  30. pic.Tag = "4";
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement