| | |
hi, how to set a proper path of a image file, many thanks!
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
I can load a image file from a fold if I did like this:
Bitmap myBitmap3 = new Bitmap(@"C:\HEapp\images\logo.bmp");
however, this is not convenient if I move my program, so I was try to do this:
Bitmap myBitmap3 = new Bitmap(@"\images\logo.bmp");
however, it doesn't work, could anyone tell me how to do this, many thanks!!
another question, how do I export a porper exe file which can run on a computer has no framework installed?
many thanks!!!!!
Bitmap myBitmap3 = new Bitmap(@"C:\HEapp\images\logo.bmp");
however, this is not convenient if I move my program, so I was try to do this:
Bitmap myBitmap3 = new Bitmap(@"\images\logo.bmp");
however, it doesn't work, could anyone tell me how to do this, many thanks!!
another question, how do I export a porper exe file which can run on a computer has no framework installed?
many thanks!!!!!
It needs to be an absolute path to the file, so you need to use Server.MapPath()
like so...
Bitmap myBitmap3 = new Bitmap(Server.MapPath("~/images/logo.bmp"));
(Assuming this is a web app)
if this is not a web app, and you plan on moving this around, I suggest setting a key in the config file of the root path like <add key="root" value="C:\mystuff\" />
like so...
Bitmap myBitmap3 = new Bitmap(Server.MapPath("~/images/logo.bmp"));
(Assuming this is a web app)
if this is not a web app, and you plan on moving this around, I suggest setting a key in the config file of the root path like <add key="root" value="C:\mystuff\" />
•
•
Join Date: Jun 2005
Posts: 1
Reputation:
Solved Threads: 0
I'm not sure if this is the question that raybristol is asking, but I do wonder, how do you get a path to the place where the EXE is located, from which you can find the folder it is in and so on? What I mean is, how could you make it so you can place the EXE anywhere, whether it be C:\My Documents\HelloWorld.exe or C:\Program Files\Hello\HelloWorld.exe and the program would still be able to find out where you put it?
![]() |
Similar Threads
- how to display an attached image file in email (ASP)
- HELP! Html image file! (HTML and CSS)
- how to set relative path in a .config file? (Java)
Other Threads in the C# Forum
- Previous Thread: Displaying an Excel document in a windows application
- Next Thread: C# Winform WebClient identification
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development dll draganddrop drawing encryption enum excel file filename finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile gis globalization gtk image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia windows winforms wpf xml





