• Changing the picture in a picturebox control?
    8 replies, posted
Hi Everybody :) I need help. I want to be able to change the picture in a picturebox depending on certain variables. I tried the following code... The monkey_toy image is loaded into the project's solution... [QUOTE] pictureBox1.Image = monkey_toy.png; [/QUOTE] Any help or link to a tutorial would be appreciated :)
I think you can do [code] pictureBox1.Load("c:/lol.png"); [/code]
[QUOTE=NovembrDobby;32698287]I think you can do [code] pictureBox1.Load("c:/lol.png"); [/code][/QUOTE] Woudn't that require a set installation path that the user would have to use?
well just pb.Load("pic.png") for the same folder, who says the user has any part in this
[QUOTE=NovembrDobby;32698366]well just pb.Load("pic.png") for the same folder, who says the user has any part in this[/QUOTE] Im saying if the user installs in to a place where the program wasn't expecting the content won't be loaded properly. Am I right or wrong?
Oh, surely it wouldn't make a difference if you just put the image somewhere in the install dir and load it relative to that.
[QUOTE=NovembrDobby;32698443]Oh, surely it wouldn't make a difference if you just put the image somewhere in the install dir and load it relative to that.[/QUOTE] The load method didn't work so I imported the resources into the .resx file. I just need to know how to change the image using the .resx file as a source.
You can add it to the project resources. Then you can do: PictureBox1.Image = Project Name.Properties.Resources.Whatever.png
Thank you for all the help but Darkest fixed my issue. Thank's man! :)
Sorry, you need to Log In to post a reply to this thread.