4

「ヘルプ」コンテキストメニューがあるwinfromGUIがあります。クリックしたら、アプリケーションのユーザーマニュアルを開きたいのですが。マニュアルは、アプリケーションリソース内に保存されているPDFです。

質問:ユーザーのためにこれを開くにはどうすればよいですか?

使用しているコード

System.Diagnostics.Process process = new System.Diagnostics.Process();
bool adobeInstall = false;
RegistryKey adobe = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Adobe");
if (adobe != null)
{
    RegistryKey acroRead = adobe.OpenSubKey("Acrobat Reader");
    if (acroRead != null)
        adobeInstall = true;
}

if (adobeInstall == true)
{
    ///Open the pdf file??
}
4

3 に答える 3

6
string locationToSavePdf = Path.Combine(Path.GetTempPath(), "file name for your pdf file.pdf");  // select other location if you want
File.WriteAllBytes(locationToSavePdf,Properties.Resources.nameOfFile);    // write the file from the resources to the location you want
Process.Start(locationToSavePdf);    // run the file
于 2013-03-26T16:26:51.600 に答える
1

これを試してください(PDFファイルへのパスだけが必要で、リソースに追加する必要はありません):

using System.Diagnostics;

Process.Start(“Path_of_PDFFile”)
于 2013-03-26T16:22:16.013 に答える
1

使用に追加using System.Diagnostics;してから、次のように呼び出します。

Process.Start("path to pdf")

PDFReaderexeなどを見つける必要はありません。必要なファイルのパスを呼び出すだけです。

于 2013-03-26T16:24:11.930 に答える