2

I am using c#.

I have a project running at path: D:\USER\Desktop\Prgramming\C++ 2020-2021\project\projectGraphics\projectGraphics\bin\Debug The Project directory looks like this: Project directory

I want to get constantly (in any computer) from an .exe file in Debug to an image in Resources efficiently. How can I do that?

Ilan Yashuk
  • 145
  • 1
  • 9

1 Answers1

2

Do you use WinForms or WPF?

Add the image as a "resource" in your project. Add Image to ResourceFile Afterwards you can use

Bitmap bmp = new Bitmap(Properties.Resources.myImageFile);

to access the image.

user8606929
  • 226
  • 1
  • 12
  • I want to set the Image I selected as in `Image ButtonBase.Image`. Can I do that? – Ilan Yashuk Dec 27 '20 at 12:54
  • You can use it anywhere in the project as background, as an image, as what you want, but the file will be stored in resource file, not like a simple image file. Otherwise you can add file to the project and set "Copy to output directory" property to "Copy always" or "Copy as newer" and use path to them. – Ivan Khorin Dec 27 '20 at 13:14