CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Posts
    2

    Question Embedded Resources

    In visualstudio, I add background.bmp to my project. I set the Build Action on the Properties page to "Embedded Resource". Now how do I use that embedded resource in the program?

  2. #2
    Join Date
    Jun 2000
    Location
    north qld australia
    Posts
    67
    Bitmap bmap= new Bitmap(typeof(Form1),"animage.gif");

  3. #3
    Join Date
    Jun 2002
    Posts
    2

    Unhappy

    I don't understand that at all, but it works...

    How about another example.
    I have a file that I load up with several serialized objects. I open it like this:

    Stream r = File.Open("resources", FileMode.Open, FileAccess.Read);

    How would I open it if I embedded it?

  4. #4
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265
    Something like this:
    Code:
    Stream stream = this.GetType().Assembly.GetManifestResourceStream( "Namespace.resources" );

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

Featured