Results 1 to 6 of 6

Thread: How do I load an image from a resource file?

  1. #1

    Thread Starter
    Member Aerials's Avatar
    Join Date
    Jul 2002
    Location
    Chile
    Posts
    50

    How do I load an image from a resource file?


  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Public rm As System.Resources.ResourceManager = New System.Resources.ResourceManager("Resourcename", System.Reflection.Assembly.GetExecutingAssembly())

    rm.GetObject("imagename") will return the image
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Junior Member
    Join Date
    Sep 2002
    Location
    Belgium
    Posts
    16

    Question Storing GIF and JPG in resource files

    Hello,

    It seems to me that the standard resourced for VB.Net only know of BMP-files. I need to store GIF's and JPG's in a VB.Net application. Can you do this with resources? Do you know of any other ways on how to do this?

    Thanks.

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    You can store any image format.
    Dont gain the world and lose your soul

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    REsource will take any. Gif, JPg, Ico, etc.

    do this

    Dim a As New Image

    a = CType(rm.GetObject("imagename"), Image)

    a becomes an image object which can be any image format.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    Junior Member
    Join Date
    Sep 2002
    Location
    Belgium
    Posts
    16
    Thanks!

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