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 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
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
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
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
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
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 > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
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...
|
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?
...
|
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...
| |
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...
|
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...
|
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....
|
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...
|
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?
|
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,...
| |
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,...
|
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |