|
-
Feb 4th, 2009, 01:20 AM
#1
Thread Starter
PowerPoster
[Resolved][C#] Bitmap to something I can display?
Hey guys, I've got a resource file which I'm storing Bitmaps in (they're Image data type in .Net, but in the resource file they're System.Drawing.Bitmap).
I've read it out and converted it to a Bitmap, but now I need to get it to a format that I can display in WPF Image Control (takes an ImageSource I do believe). Any suggestions? :\ Google has epically failed me. 
I dunno if theres a way to change how images get stored into a Resource file, maybe that could help solve the problem.
Last edited by Pc_Madness; Feb 4th, 2009 at 03:21 AM.
Don't Rate my posts.
-
Feb 4th, 2009, 02:45 AM
#2
Re: [C#] Bitmap to something I can display?
Can't you just set the source as the path to the image in the RESX file?
Code:
<Image Source="/Assemblyname;resourcefilename/abc.jpg" />
Else you'll have to set the Image1.Source property in code by converting the Bitmap to a BitmapSource. You could look at the BitmapSource.Create method, though there may be other ways.
-
Feb 4th, 2009, 03:21 AM
#3
Thread Starter
PowerPoster
Re: [C#] Bitmap to something I can display?
 Originally Posted by mendhak
Can't you just set the source as the path to the image in the RESX file?
Code:
<Image Source="/Assemblyname;resourcefilename/abc.jpg" />
Else you'll have to set the Image1.Source property in code by converting the Bitmap to a BitmapSource. You could look at the BitmapSource.Create method, though there may be other ways.
Neg, the resource files are external, I'm using them as thumbs.db alternatives. 
But your suggestion helped me find the code I need. PngBitmapDecoder. I thought I tried that earlier, but apparently not. 
http://social.msdn.microsoft.com/For...-0cc2b0f80cf0/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|