home screen

Search



Number Of Result : 0

Result :


Saturday, June 13, 2009

WPF - How to use Image Embeded Resource from c# code?

1. Add your image (I take a png file) to your solution
2. Use this code:


Assembly myAssembly = Assembly.GetExecutingAssembly();
Stream myStream = myAssembly.GetManifestResourceStream("WpfApplication1.testimage.png");

PngBitmapDecoder bd = new PngBitmapDecoder
(myStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
Image1.ImageSource = bd.Frames[0];

No comments: