C# WPF Load images from the exe folder -


i want move program pc problem images not loaded on other pc (source problem) . wondering if create folder exe placed , name resources , load every image there.

image2.source = new bitmapimage(new uri(@"res\startoh.png")); 

you may add images resources visual studio project. packed assembly of executable , don't need copy them separately.

create folder in project (let's called images) , add images folder.

enter image description here

make sure build action images set resource.

enter image description here

now can create bitmapimage such resource appropriate pack uri:

var uri = new uri("pack://application:,,,/images/someimage.png"); image.source = new bitmapimage(uri); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -