c# - How to display a PNG from a file? -


i want switch image displayed on toolstripbutton. juste can't find how that.

i think should like:

btsearch.image = new image("myimage.png"); 

but doesn't work ( new image seems not exist).

thank help

i recommend image.fromstream() method doesn't lock actual file.

for example:

using (var stream = file.openread(path)) using (var image = image.fromstream(stream)) {     //black magic here. } 

note must keep stream open lifetime of image. stream reset 0 if method called successively same stream.

here's previous discussion answer jon skeet.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -