Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Getting image from embedded resource

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Resolved [RESOLVED] [2005] Getting image from embedded resource

    I currently grab an image from an embedded resource using
    VB Code:
    1. Dim WImage As Image = New Bitmap(Me.GetType(), "myimage.png")
    but the result is poor compared to the original png. The conversion to a bitmap seems to dramatically lower the quality since any white space in the image gets filled with a different color. I tried improving the PixelFormat, but it does not have much effect. Is there a way I can get the image directly, rather than having to go through a bitmap?

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Getting image from embedded resource

    Actually, the problem is not the bitmap quality, it is the appearance of the image when used as a ListView item image. If I put the image into a picturebox, it looks perfect, use it in a listview, looks horrible.



    The left image is a picture box, the right is when the same image is used in a ListView.
    What am I missing here?

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Getting image from embedded resource

    That's the ImageList doing that. What is the ColorDepth property of the ImageList set to?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] Getting image from embedded resource

    It's "Depth8bit", so I guess it should be something better. Can I use any value?, or should I stick to something that will display properly on all computers?

    32Bit looks perfect.

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [RESOLVED] [2005] Getting image from embedded resource

    You should use the highest value that doesn't require you to downsample any of the contained images. If the highest resolution of any of the images is 24 bit then use 24 bit. If in doubt play it safe and use the highest.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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