在我当前的窗口上,我有一个按钮.我希望能够单击该按钮并打开该项目的资源文件夹中的.pdf文件.有没有想要做到这一点?
我看过的其他方法使用文件路径,但文件路径可能不是一直相同,但.pdf文件始终位于资源文件夹中.有没有办法访问它并在单击按钮时打开它?
有什么事吗?
string filename = "instructions.pdf";
file.open();
Run Code Online (Sandbox Code Playgroud)
问题解决了
private void Button1_Click(object sender, EventArgs e)
{
string filename = "instructions.pdf";
System.Diagnostics.Process.Start(filename);
}
Run Code Online (Sandbox Code Playgroud)
使用program.exe所在的bin/debug文件夹中的instructions.pdf.