Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Windows Application I need to Save Image In Solution Explorer... I Have Folder Image In Solution Explorer.....May be some time I may change the application to some other drive... that time path to correctly want to get for save image.
Posted
Updated 22-Feb-12 1:44am
v3

Place the save image in the Image folder. And in the image/image button reference just mention the url as "~/Image/imagename.imageextension"

PS: I guess you are moving the application along with Image folder also.
 
Share this answer
 
Comments
itsureshuk 22-Feb-12 7:06am    
Its not working for Windows application
beevif 22-Feb-12 7:23am    
How you are setting the image?
itsureshuk 22-Feb-12 7:24am    
s...i am moving total file
beevif 22-Feb-12 7:27am    
kindly follow solution2.
itsureshuk 22-Feb-12 7:38am    
which one
Store the images as resources within your application. That way you can move it everywhere you want and all necessary images are available anytime from Properties.Resources. namespace.

You will, of course, get a significantly larger executable.

To do that
- Open Solution Explorer.
- Right-click on your project.
- Select "Properties".
- From the horizontal tabs, select "Resources".
- From that tab's menu, select "Add Resource" (use the small down-arrow).
- Select "Add existing file..."
- In the OpenFileDialogue, select your images (maybe you have to fiddle with the file type drow-down).
During next build, the images get compiled into your executable.
- You can reach an image called "MyImage.png" from your code via Properties.Resources.MyImage. It will be of type System.Drawing.Bitmap.
 
Share this answer
 
v2
Comments
itsureshuk 22-Feb-12 7:25am    
can you explain briefly...plz
lukeer 22-Feb-12 8:11am    
I updated my solution.
XxJasonxX 10-Apr-12 3:24am    
If size is an issue, you can use an image format with high compression such as J2K. The following code will load the image as a resource to a stream:
===============
Stream stm = new MemoryStream();
System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly();
Stream myStream = myAssembly.GetManifestResourceStream("WindowsFormsApplication12.Resources.J2K_X4.bin");
===============
This leaves 2 problem:
1. Encoding the image as J2K.
2. Decoding the J2K image from the resource stream.

For both, you can use a commercial DLL such as leadtools or a free library such as FreeImage. The obvious advantage of FreeImage is that it costs nothing, but it won't load the image from stream directly. You will have to dump it to disk, load it from there, save it back to disk in another format then load the other format.

My own code is a commercial application (KG educational system), so it was feasible for my company to foot the bill and buy lead tools. We ended up shipping about 2300 photos as resources with our app, all encoded as lossless J2K and protected with encryption algorithm, also using the same toolkit.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900