Path for image files in project

11,308

Solution 1

You can and also should put your images into the projects resoucre-file (embed it).

Then, you can access your resource at runtime like any other object.

System.Drawing.Bitmap bitmap1 = myProject.Properties.Resources.Image01;

Look at this MSDN page for more information: http://msdn.microsoft.com/en-us/library/7k989cfy%28VS.80%29.aspx

Solution 2

You probably want to think about making your image an embedded resource. This will embed it in the exe. This article should explain it.

Share:
11,308
rd42
Author by

rd42

Updated on June 04, 2022

Comments

  • rd42
    rd42 almost 2 years

    I have an image in my project that I want to go along with the program. If I was going to use something like BitmapImage() what would I use for the path? I don't want to use the c:\blah blah blah because that could change depending on were it is on each PC. Is it called a "relative path"?