如何不断从内部目录获取相同的目录路径

How to constantly get same directory path from inner directory

我正在使用 C#。

我在路径中有一个项目 运行: D:\USER\Desktop\Prgramming\C++ 2020-2021\project\projectGraphics\projectGraphics\bin\Debug 项目目录如下所示:

我想不断(在任何计算机上)从调试中的 .exe 文件高效地获取资源中的图像。我该怎么做?

您使用 WinForms 还是 WPF?

将图像添加为项目中的“资源”。 之后你可以使用

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

访问图像。