PC Review


Reply
Thread Tools Rate Thread

Embedded resource question

 
 
Tomer
Guest
Posts: n/a
 
      27th Dec 2004
Hi,

I've a gif in my project inside one of its directories (for example: Graphics\Icons), its is compiled as embedded resource.

I can't get the gif's stream when calling the method:
Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif");
Where GUI is the assembly name, and Battery1.gif is the image name.

This line works fine when the image is in the root of the project.

How can I make it work from directories?



Tomer.

 
Reply With Quote
 
 
 
 
Sergey Bogdanov
Guest
Posts: n/a
 
      27th Dec 2004
Assuming that your image is placed into directory "Graphics\Icons" to
retrieve this image you should write something like this:

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Graphics.Icons.Battery1.gif");

Since you have to explicitly set the full path to the image in you assembly.


Tomer wrote:
> Hi,
>
> I've a gif in my project inside one of its directories (for example:
> Graphics\Icons), its is compiled as embedded resource.
>
> I can't get the gif's stream when calling the method:
> Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif");
>
> Where GUI is the assembly name, and Battery1.gif is the image name.
>
> This line works fine when the image is in the root of the project.
>
> How can I make it work from directories?
>
>
>
> Tomer.
>



--
Best regards,
Sergey Bogdanov
 
Reply With Quote
 
Tomer
Guest
Posts: n/a
 
      27th Dec 2004
Will it work with directories with embedded spaces, like "Status bar\Icons"?

Tomer.


"Sergey Bogdanov" <(E-Mail Removed)> wrote in message
news:uAUzBY$(E-Mail Removed)...
> Assuming that your image is placed into directory "Graphics\Icons" to
> retrieve this image you should write something like this:
>
>

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Graphics.Icon
s.Battery1.gif");
>
> Since you have to explicitly set the full path to the image in you

assembly.
>
>
> Tomer wrote:
> > Hi,
> >
> > I've a gif in my project inside one of its directories (for example:
> > Graphics\Icons), its is compiled as embedded resource.
> >
> > I can't get the gif's stream when calling the method:
> >

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif"
);
> >
> > Where GUI is the assembly name, and Battery1.gif is the image name.
> >
> > This line works fine when the image is in the root of the project.
> >
> > How can I make it work from directories?
> >
> >
> >
> > Tomer.
> >

>
>
> --
> Best regards,
> Sergey Bogdanov



 
Reply With Quote
 
Sergey Bogdanov
Guest
Posts: n/a
 
      27th Dec 2004
A namespace can't contain whitespaces that's why you can't embed your
image into the directory with a space like "Status bar" but you can
rename it like "Status_Bar", "StatusBar" ...

Tomer wrote:
> Will it work with directories with embedded spaces, like "Status bar\Icons"?
>
> Tomer.
>
>
> "Sergey Bogdanov" <(E-Mail Removed)> wrote in message
> news:uAUzBY$(E-Mail Removed)...
>
>>Assuming that your image is placed into directory "Graphics\Icons" to
>>retrieve this image you should write something like this:
>>
>>

>
> Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Graphics.Icon
> s.Battery1.gif");
>
>>Since you have to explicitly set the full path to the image in you

>
> assembly.
>
>>
>>Tomer wrote:
>>
>>>Hi,
>>>
>>>I've a gif in my project inside one of its directories (for example:
>>>Graphics\Icons), its is compiled as embedded resource.
>>>
>>>I can't get the gif's stream when calling the method:
>>>

>
> Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif"
> );
>
>>>Where GUI is the assembly name, and Battery1.gif is the image name.
>>>
>>>This line works fine when the image is in the root of the project.
>>>
>>>How can I make it work from directories?
>>>
>>>
>>>
>>>Tomer.
>>>

>>
>>
>>--
>>Best regards,
>>Sergey Bogdanov

>
>
>



--
Best regards,
Sergey Bogdanov
 
Reply With Quote
 
Tomer
Guest
Posts: n/a
 
      27th Dec 2004
Thanks a bunch!!!

Tomer.



"Sergey Bogdanov" <(E-Mail Removed)> wrote in message
news:epa1O2$(E-Mail Removed)...
> A namespace can't contain whitespaces that's why you can't embed your
> image into the directory with a space like "Status bar" but you can
> rename it like "Status_Bar", "StatusBar" ...
>
> Tomer wrote:
> > Will it work with directories with embedded spaces, like "Status

bar\Icons"?
> >
> > Tomer.
> >
> >
> > "Sergey Bogdanov" <(E-Mail Removed)> wrote in message
> > news:uAUzBY$(E-Mail Removed)...
> >
> >>Assuming that your image is placed into directory "Graphics\Icons" to
> >>retrieve this image you should write something like this:
> >>
> >>

> >
> >

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Graphics.Icon
> > s.Battery1.gif");
> >
> >>Since you have to explicitly set the full path to the image in you

> >
> > assembly.
> >
> >>
> >>Tomer wrote:
> >>
> >>>Hi,
> >>>
> >>>I've a gif in my project inside one of its directories (for example:
> >>>Graphics\Icons), its is compiled as embedded resource.
> >>>
> >>>I can't get the gif's stream when calling the method:
> >>>

> >
> >

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif"
> > );
> >
> >>>Where GUI is the assembly name, and Battery1.gif is the image name.
> >>>
> >>>This line works fine when the image is in the root of the project.
> >>>
> >>>How can I make it work from directories?
> >>>
> >>>
> >>>
> >>>Tomer.
> >>>
> >>
> >>
> >>--
> >>Best regards,
> >>Sergey Bogdanov

> >
> >
> >

>
>
> --
> Best regards,
> Sergey Bogdanov



 
Reply With Quote
 
John Kendrick
Guest
Posts: n/a
 
      27th Dec 2004
Actually you can place resources in folders with spaces like "Status bar".
When referencing this is code you substitute the space with an underscore
like "Status_bar" and Visual Studio does the rest.

"Sergey Bogdanov" <(E-Mail Removed)> wrote in message
news:epa1O2$(E-Mail Removed)...
> A namespace can't contain whitespaces that's why you can't embed your
> image into the directory with a space like "Status bar" but you can
> rename it like "Status_Bar", "StatusBar" ...
>
> Tomer wrote:
> > Will it work with directories with embedded spaces, like "Status

bar\Icons"?
> >
> > Tomer.
> >
> >
> > "Sergey Bogdanov" <(E-Mail Removed)> wrote in message
> > news:uAUzBY$(E-Mail Removed)...
> >
> >>Assuming that your image is placed into directory "Graphics\Icons" to
> >>retrieve this image you should write something like this:
> >>
> >>

> >
> >

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Graphics.Icon
> > s.Battery1.gif");
> >
> >>Since you have to explicitly set the full path to the image in you

> >
> > assembly.
> >
> >>
> >>Tomer wrote:
> >>
> >>>Hi,
> >>>
> >>>I've a gif in my project inside one of its directories (for example:
> >>>Graphics\Icons), its is compiled as embedded resource.
> >>>
> >>>I can't get the gif's stream when calling the method:
> >>>

> >
> >

Assembly.GetExecutingAssembly().GetManifestResourceStream("GUI.Battery1.gif"
> > );
> >
> >>>Where GUI is the assembly name, and Battery1.gif is the image name.
> >>>
> >>>This line works fine when the image is in the root of the project.
> >>>
> >>>How can I make it work from directories?
> >>>
> >>>
> >>>
> >>>Tomer.
> >>>
> >>
> >>
> >>--
> >>Best regards,
> >>Sergey Bogdanov

> >
> >
> >

>
>
> --
> Best regards,
> Sergey Bogdanov



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resource manager problem: naming for embedded resource. Dirc Khan-Evans Microsoft ASP .NET 1 17th Oct 2005 02:52 PM
Embedded Resource Question wackyphill@yahoo.com Microsoft C# .NET 1 26th Jul 2005 09:15 PM
Question about embedded resource Leonardo D'Ippolito Microsoft C# .NET 5 17th Nov 2004 04:37 PM
Re: Question about embedded resource Cor Ligthert Microsoft Dot NET 0 17th Nov 2004 10:42 AM
can I call getString() to get a string from a separate resource file instead of embedded resource? babylon Microsoft Dot NET Framework 2 7th Oct 2003 05:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:08 PM.