Results 1 to 3 of 3

Thread: [Resolved][C#] Bitmap to something I can display?

  1. #1

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    [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.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    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.

  3. #3

    Thread Starter
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765

    Re: [C#] Bitmap to something I can display?

    Quote 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/
    Don't Rate my posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width