PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Embedded resource question
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Compact Framework
Embedded resource question
![]() |
Embedded resource question |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Will it work with directories with embedded spaces, like "Status bar\Icons"?
Tomer. "Sergey Bogdanov" <sergey.bogdanov@gmail.com> wrote in message news:uAUzBY$6EHA.3596@TK2MSFTNGP12.phx.gbl... > 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 |
|
|
|
#4 |
|
Guest
Posts: n/a
|
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" <sergey.bogdanov@gmail.com> wrote in message > news:uAUzBY$6EHA.3596@TK2MSFTNGP12.phx.gbl... > >>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 |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Thanks a bunch!!!
Tomer. "Sergey Bogdanov" <sergey.bogdanov@gmail.com> wrote in message news:epa1O2$6EHA.128@TK2MSFTNGP15.phx.gbl... > 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" <sergey.bogdanov@gmail.com> wrote in message > > news:uAUzBY$6EHA.3596@TK2MSFTNGP12.phx.gbl... > > > >>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 |
|
|
|
#6 |
|
Guest
Posts: n/a
|
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" <sergey.bogdanov@gmail.com> wrote in message news:epa1O2$6EHA.128@TK2MSFTNGP15.phx.gbl... > 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" <sergey.bogdanov@gmail.com> wrote in message > > news:uAUzBY$6EHA.3596@TK2MSFTNGP12.phx.gbl... > > > >>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 |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

