Guest User

Untitled

a guest
Aug 16th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. How do I put an image into my picturebox using ImageLocation?
  2. PictureBox picture = new PictureBox
  3. {
  4. Name = "pictureBox",
  5. Size = new Size(100, 50),
  6. Location = new Point(14, 17)
  7. };
  8. p.Controls.Add(picture);
  9. picture.ImageLocation = @"..Image1.jpg";
  10.  
  11. picture.ImageLocation = @"Image1.jpg";
  12.  
  13. PictureBox picture = new PictureBox
  14. {
  15. Name = "pictureBox",
  16. Size = new Size(100, 50),
  17. Location = new Point(14, 17),
  18. Image = Image.FromFile(@"c:Imagestest.jpg"),
  19. SizeMode = PictureBoxSizeMode.CenterImage
  20. };
  21. p.Controls.Add(picture);
  22.  
  23. PictureBox picture = new PictureBox
  24. {
  25. Name = "pictureBox",
  26. Size = new Size(100, 50),
  27. Location = new Point(14, 17),
  28. ImageLocation = @"c:Imagestest.jpg",
  29. SizeMode = PictureBoxSizeMode.CenterImage
  30. };
  31. p.Controls.Add(picture);
  32.  
  33. picture.ImageLocation = Path.Combine(System.Windows.Forms.Application.StartupPath, "ResourcesImages1.jpg");
Add Comment
Please, Sign In to add comment