运用 System.AppDomain.CurrentDomain.BaseDirectory 您可以获取可执行文件的基本目录。
System.AppDomain.CurrentDomain.BaseDirectory
因此,您可以使用此代码使用默认应用程序打开PDF文件:
Process.Start( _ IO.Path.Combine( System.AppDomain.CurrentDomain.BaseDirectory, _ "your_resources_folder", _ "your_pdf_file.pdf" ) )
请注意,您的可执行调试是在 \bin\debug 你的项目的文件夹;所以最好用:
\bin\debug
Process.Start( _ IO.Path.Combine( IIf(Not Debugger.IsAttached, _ System.AppDomain.CurrentDomain.BaseDirectory, _ Strings.Replace(UCase(System.AppDomain.CurrentDomain.BaseDirectory), UCase("\bin\debug\"), "") _ ), _ "your_resources_folder", _ "your_pdf_file.pdf" ) )