Open a image

Mickeys
Mickeys used Ask the Experts™
on
I use this

Bitmap backgroundImage = new Bitmap(Directory.GetCurrentDirectory() +"\\images\\" + "player1_back_hit.gif");
            drawingSurface.DrawImage((backgroundImage), location);

but my //image// is here
"C:\\Documents and Settings\\MFL\\Dokumenter\\Visual Studio 2008\\Projects\\Black_Jack\\Black_Jack\\images

and hte Directory.GetCurrentDirectoy() is here
"C:\\Documents and Settings\\MFL\\Dokumenter\\Visual Studio 2008\\Projects\\Black_Jack\\Black_Jack\\bin\\Debug"


So my question is. How can I make it open in the correct directory?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
If you have an Images folder as part of the project, with the images inside, you can right-click each image in Solution Explorer, hit properties, then select 'Copy If Newer' or 'Copy Always'. When you next compile, an Images subfolder'll appear in your Debug directory with the images in. The name of the folder generated under bin\Debug will be the same as that of the folder in your project.

In fact, what it's currently doing it correct since your .exe lives in the bin\Debug directory. That directory contains all of the files output from your project.
Commented:
Put the images in a resource file.
This way it is placed inside the Exe file so you don't need to put it in another folder, and it also prevents the user from altering the images in an easy way.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial