Image Resources in .NET 
Author Message
 Image Resources in .NET

Okay, Microsoft's new design is BUNK.

I have spent 24 hours.......no, WASTED 24 hours trying to
figure out how to do image resources from the Visual
Studio.NET UI in C#.  WHY IS THIS SO FREAKING HARD?

God I wish I stuck to C++.  As it is, I have to convert
all this code over.  Like I can really afford to lose
this much time because someone had their heads up their
ass when desiging this.

Here is my problem.  I insert the images, change the
types to embedded resource.  I then create a resource
manager, and try to pull in the images.  I made a Resx
file because it kept crashing, but nowhere does anything
say what to enter in it!  Not only that, but all of
Microsoft's documentation figures you are using command
line tools.........WTF is with that, I paid my $500
damnit, tell me how to use what I bought.  Can anyone
tell I'm extreamly frustrated?  Please help.  The code
below is returning null for the object handle.

HoverImages = new Image[3];
ResourceManager RMgr = new ResourceManager
("RNControls.Images", Assembly.GetExecutingAssembly());

HoverImages[0] = (System.Drawing.Image) RMgr.GetObject
("RNControls.Images.ToolbarHoverStart.bmp");



Fri, 24 Sep 2004 09:18:00 GMT  
 Image Resources in .NET

Quote:

>Okay, Microsoft's new design is BUNK.

Not really, you just don't understand everything you need to understand - yet.

Quote:
>Here is my problem.  I insert the images, change the
>types to embedded resource.

Having done that all you really need is the following:

   Stream s =
      GetType().Assembly.GetManifestResourceStream(
        "MimeMessageExplorer.mabrylogo.jpg");

Where MimeMessageExplorer is the name of your assembly.  You can create a bitmap
using the following:

   Bitmap bm = new Bitmap(s);

--




Fri, 24 Sep 2004 10:37:49 GMT  
 Image Resources in .NET
Wow, thanks.
That was easy.....although I'd have to say their
documentation on the subject leaves much to be
desired....Win32/MFC was a lot more well documented on
the subject of resources.....I still don't see why 99% of
the documentation on .NET resources is about command line
compiling.....if I wanted to do command line compiling I
wouldnt have bought the studio.

Thanks again, you have no idea how much I appreciate your
help.

-Dan

Quote:
>-----Original Message-----

>>Okay, Microsoft's new design is BUNK.

>Not really, you just don't understand everything you

need to understand - yet.
Quote:

>>Here is my problem.  I insert the images, change the
>>types to embedded resource.

>Having done that all you really need is the following:

>   Stream s =
>      GetType().Assembly.GetManifestResourceStream(
>        "MimeMessageExplorer.mabrylogo.jpg");

>Where MimeMessageExplorer is the name of your assembly.  

You can create a bitmap
Quote:
>using the following:

>   Bitmap bm = new Bitmap(s);

>--


>.



Fri, 24 Sep 2004 10:21:41 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to add image into resource file using VS.NET

2. Cool Resources Editor/Viewer for .NET + sourcecode (.resources/.resX)

3. any resource for CE.net on the net ?

4. Embedding image resources in vis studio c# ?

5. Embedded image resource...

6. Image Resource file

7. Image resources in C#

8. VC5: ERROR: Image file does not contain a resource section

9. Resource Editor - Toolbar Images

10. BMP image hotspots and resources?

11. Image loses quality when added as a resource

12. Loading an image into resource at runtime ?

 

 
Powered by phpBB® Forum Software