C# 平板电脑设备中的图像路径错误
创建项目时,我将图像路径引用为@…\Assets\no_picture\u available1.gif运行正常,当我在其他机器上安装应用程序时,显示路径不可用 我试过用这个C# 平板电脑设备中的图像路径错误,c#,path,tablet,C#,Path,Tablet,创建项目时,我将图像路径引用为@…\Assets\no_picture\u available1.gif运行正常,当我在其他机器上安装应用程序时,显示路径不可用 我试过用这个 System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"..\..\Assets\no_picture_available1.gif"; 它将路径显示为 "F:\\WindowsApp\\UI\\bin\\D
System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + @"..\..\Assets\no_picture_available1.gif";
它将路径显示为
"F:\\WindowsApp\\UI\\bin\\Debug..\\..\\Assets\\no_picture_available1.gif"
如何设置资产文件夹的路径?我找到了问题的解决方案,问题在于资产路径, 调试时,我将路径设置为不同的路径,而在发布模式下,我将路径设置为不同的路径
string pathdir = Path.Combine(System.Windows.Forms.Application.StartupPath, "Assets\\no_picture_available1.gif");
#if DEBUG
return pathdir = @"../../Assets/no_picture_available1.gif";
#else
return pathdir;
#endif