Change Image in Resources at Runtime

Posted by zaidwaqi on Stack Overflow See other posts from Stack Overflow or by zaidwaqi
Published on 2010-05-06T06:12:49Z Indexed on 2010/05/06 6:18 UTC
Read the original article Hit count: 153

Filed under:
|
|

Hi,

My understanding of Resources is that I can combine resources i.e. images and my program into single executable.

Let's say I have image pic1.png and I put it into Resource of my project, and is accessible with Properties.Resource.pic1.

For example,

PictureBox pb = new PictureBox();
pb.Image = Properties.Resource.pic1;

What I want to do is for that my program will be able to replace this image at runtime. For example, my program runs, and locate newPicture.png, and use this new image to replace pic1.png that was originally used.

Maybe my question is better reworded as "Can I include new image into Resources at runtime?"

Please help. Thanks.

© Stack Overflow or respective owner

Related posts about c#

Related posts about windows-forms