all groups > c# > april 2004 >
You're in the

c#

group:

ImageList for high-resolution images??


ImageList for high-resolution images?? Vaughn
4/11/2004 11:54:25 PM
c#: Is there some way I can save images (bigger than 16x16 pixels) so they don't
reside as physical files on the HDD? I'm working on a screensaver but I want
to include all my images in my executable instead of having them reside in
the hard disk.
Since I use a pictureBox and the image comes from a file at runtime (eg.
pictureBox1.Image = Image.FromFile (path); ), more computer-literate users
can delete the image, copy another image with the same name, and view the
new image. And I want to avoid that.

Thanks,
Vaughn

Re: ImageList for high-resolution images?? Justin Rogers
4/11/2004 11:58:27 PM
You can embed images as resources in your assembly.

/res:ImageFile.bmp

Then you can grab the resource stream using
Assembly.GetManifestResourceStream(...)
and reconstruct your bitmaps in memory.


--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

[quoted text, click to view]

Re: ImageList for high-resolution images?? Vaughn
4/12/2004 10:35:18 AM
Thanks for the reply.
I have framework v1.0 . Would it work with this version also? Since this is
the first time I work with images, I'm not sure how to embed the image into
my project as resources. I also don't know how to set the Build Action to
"Embedded resource".

Thanks,
Vaughn

[quoted text, click to view]

Re: ImageList for high-resolution images?? Erik Tamminga
4/12/2004 11:01:59 AM
Hi,

Include the images in the project. Set the "Build action" (file property) to
"Embedded resource" and use "Assembly.GetManifestResourceStream()" to fetch
the image runtime.

Erik

[quoted text, click to view]

Re: ImageList for high-resolution images?? Vaughn
4/12/2004 10:14:50 PM
Thanks for the info. I was able to add it.
But once I add it, how can I access it? The name of the image in the
solution is test.jpg and I want to use it as the image for a pictureBox
control (eg. pictureBox1.Image = test.jpg;).

Thanks again,
Vaughn

[quoted text, click to view]

Re: ImageList for high-resolution images?? Bob Powell [MVP]
4/12/2004 10:27:28 PM
It will work with 1.0 but I strongly reccommend that you upgrade to 1.1 as
soon as possible.

Add the bitmap object to your solution and then select "Build
action"="Embedded Resource" in the properties pane.

--
Bob Powell [MVP]
Visual C#, System.Drawing

All you ever wanted to know about ListView custom drawing is in Well Formed.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Re: ImageList for high-resolution images?? Vaughn
4/12/2004 10:36:58 PM
Hi,
I found an article explaining how to use these resources in C#. And it's
looking pretty good.
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=75

Thanks,
Vaughn

[quoted text, click to view]

AddThis Social Bookmark Button