c# - WPF Program Could not Find an Image, and then he didn't find all of them -


i making game , have tons of images loaded content. when try , run game image not found. next time run game different image not found. tried going line line , fixing can't.

i have custom made user controls have button on them , set background image using c#.

 public bitmapimage getbitmapofimage()     {         try         {             var = new bitmapimage(new uri(string.format("imgfolder/{0}.png", this.tostring()), urikind.relativeorabsolute));             return a;         }         catch (exception)         {             messagebox.show("erorr");             throw;         }     } 

tostring gives unique name gave file goes object. bitmapimmage used in next stage:

        var brush = new imagebrush();         brush.imagesource =item.getbitmapofimage();         this.item_button.background = brush;         this.item_button.begininit();         this.item_button.endinit(); 

if can see problem here tell me because might not here, , think on else code might funky.

this first time doing big project in wpf. , rest gave up.

thanks!

final edit: state: solved

the last image had different problem fixed lot.

as in comments mentioned, make sure setting on "copy if newer" or "copy always".

properties


Comments

Popular posts from this blog

c# - Store DBContext Log in other EF table -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -