更新时间:2023-02-12 21:42:36
您可以使用System.Diagnostics.Process.Start以及WIN32 ShellExecute函数interop,用于使用默认查看器打开 PDF 文件:
you can use System.Diagnostics.Process.Start as well as WIN32 ShellExecute function by means of interop, for opening PDF files using the default viewer:
System.Diagnostics.Process.Start("SOMEAPP.EXE","Path/SomeFile.Ext");
[System.Runtime.InteropServices.DllImport("shell32. dll")]
private static extern long ShellExecute(Int32 hWnd, string lpOperation,
string lpFile, string lpParameters,
string lpDirectory, long nShowCmd);
另一种方法是将 WebBrowser Control 放入您的表单中,然后使用 Navigate 方法打开 PDF 文件:
Another approach is to place a WebBrowser Control into your Form and then use the Navigate method for opening the PDF file:
ThewebBrowserControl.Navigate(@"c: he_file.pdf");