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.
make sure build action images set resource
.
now can create bitmapimage such resource appropriate pack uri:
var uri = new uri("pack://application:,,,/images/someimage.png"); image.source = new bitmapimage(uri);
Comments
Post a Comment