473,473 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ImageList for high-resolution images??

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
Nov 16 '05 #1
6 1078
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #2
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #3
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #4
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:OT*************@TK2MSFTNGP12.phx.gbl...
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
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


Nov 16 '05 #5
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

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:OT*************@TK2MSFTNGP12.phx.gbl...
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
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



Nov 16 '05 #6
Hi,
I found an article explaining how to use these resources in C#. And it's
looking pretty good.
http://www.devhood.com/tutorials/tut...tutorial_id=75

Thanks,
Vaughn

"Vaughn" <vo******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:uH**************@TK2MSFTNGP09.phx.gbl...
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:OT*************@TK2MSFTNGP12.phx.gbl...
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

"Vaughn" <vo******@yahoo.com> wrote in message
news:eo**************@TK2MSFTNGP12.phx.gbl...
> 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
>
>



Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: What-a-Tool | last post by:
Is possible to use the windows image list for icon display in my treeview control? Would appreciate it you could point me towards a code sample or Key phrase to use in a google search. Thanks...
4
by: Chuck | last post by:
When ever I try to implement an ImageList, I always get an exception when the application runs. The ImageList doesn't even have to be used by anything. An empty ImageList doesn't throw! The...
0
by: Sean | last post by:
Hi all, I am building this application with a listview and I need both imageList and checkboxes to be there. But it seems like after I added the imageList, the checkboxes somehow was...
11
by: Juan Romero | last post by:
Hey guys, I have an ImageList control that stores my icons. What I need to do is find out if the icon at hand already exists in the ImageList so I dont enter it twice. How can I do that? ...
1
by: Webster | last post by:
Hello, I created a User Control consisting of a TreeView and an ImageList. I've populated the ImageList with pictures (design-time using the Properties Window), and I've added some Nodes to the...
2
by: sonu | last post by:
Hi, I have a problem for use of imagelist. The problem is I have written a code which returns me the icons associated with the files depending on their type. After getting the icon for the...
2
by: Hawk | last post by:
private void RetreiveVirtualItem( object sender, RetrieveVirtualItemEventArgs e ) { e.Item = new ListViewItem( e.ItemIndex.ToString() ); } Take this for example; works fine. Now if I want...
6
by: henrycortezwu | last post by:
Hi, I have a WinXPSP2, P4 3.2GHZ, 1GIG RAM on my dev machine using VS2005 VB.NET. I did the following procedure: 1. Added 82 icons (128x128 in size & 32bit Depth) in an imagelist control 2....
1
by: DK | last post by:
I have an image list control on a user control that I'm trying to access from the main form. I've tried different code but can't get it. I get an error: Cannot convert type...
3
xtianixm
by: xtianixm | last post by:
if i insert a high quality of icon in an imagelist it always return invalid picture is there something to remedy on that?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.