newbie question

  • Thread starter Thread starter Joshua Moore
  • Start date Start date
J

Joshua Moore

I have 20 or so BMP's i have to use, but it'd be cleaner, since they're
embedded, to throw them in a new project folder. However, when I do, I
can't access them.

Who ever said there was no stupid questions.

Thanks,
 
So is the problem that you have 20 bmp's in your solution explorer and you
don't want them to all be shown because it makes it look cluttered? Or are
you talking about something different here?
 
Are you trying to make them embedded resources? If so, set their build
action property to Embedded Resource and you can reference them like this:

Bitmap b = new
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("ProjectName.ImageFileName.jpg"));

HTH,

Bill
 
I have 40 items in my project, and don't want to scroll through all the
BMP's, so I created a folder to hide them from view. I used to pass in
<fileName> (ex. say border.bmp), then they full path would be "NameSpace." +
<fileName>", but now they aren't being found.

Thanks for your help,
 
That's what I did, and it worked, until I put all the BMP's in a BMP folder
under the project (using the solution explorer), and then the BMP's don't
load anymore.

Thanks,
Josh
 
Think it should be
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("ProjectName.FolderName.ImageFileName.jpg"));

in that case - the embedded resources are addressed with their namespace and
file path which should include the foldername.

Peter
 
Thanks...namespace.folder.filename.fileExtension worked great.

Josh

Peter Foot said:
Think it should be
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource
Stream("ProjectName.FolderName.ImageFileName.jpg"));

in that case - the embedded resources are addressed with their namespace and
file path which should include the foldername.

Peter

--
Peter Foot
Windows Embedded MVP
OpenNETCF.org Senior Advisor
www.inthehand.com | www.opennetcf.org

Joshua Moore said:
That's what I did, and it worked, until I put all the BMP's in a BMP folder
under the project (using the solution explorer), and then the BMP's don't
load anymore.

Thanks,
Josh
Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResource do,
 
.... and just for future reference, if you're ever not sure what the full
name is for an embedded resource you can check it in the manifest using the
ildasm.exe utility. Once you find it in the manifest you can just cut and
paste it into your code.
 
Back
Top