【问题标题】:Chm file external links do not work on winformchm文件外部链接在winform上不起作用
【发布时间】:2015-12-21 09:16:56
【问题描述】:

当我双击打开我的 chm 文件时,所有外部链接都可以使用。但是当我通过 winform 按钮单击事件打开我的 chm 文件时,外部链接不起作用。 外部链接包括一些 pdf 文件。我开始 chm 如下;

pDokumantationCHMFile.StartInfo.FileName = @"C:\Users\Administrator\Desktop\MANUEL\Example.chm";
pDokumantasyonCHMFile.Start();

这可能是什么原因?

【问题讨论】:

  • 我不太确定,但这是您的代码示例中的错字吗?pDokumantasyonCHMFile.Start(); => pDokumantationCHMFile.Start();
  • 是的,我用这种方式启动 chm

标签: c# winforms chm


【解决方案1】:

我认为链接文件在本地开发文件夹和生成的“\bin”文件夹中的位置不同。请确保所有文件(CHM 和 PDF)都在同一位置,并且始终发布在您的应用程序发布文件夹中。

如果这可能没有帮助,请查看以下线程中提到的示例下载: How to open specific topic from a chm file?

我通过 Process.Start 做的方式(仅作为示例 - 这不是最好的方式):

    private void button1_Click(object sender, EventArgs e)
    {
        string helpFilePath = Application.StartupPath + @"\help-subfolder\C-Sharp-CHM-example.chm";
        // Verify if the file exists
        if (File.Exists(helpFilePath))
        {
            Process.Start(helpFilePath);
        }
        else
        {
            Console.WriteLine(string.Format("File not found [{0}]", helpFilePath));
        }
    }

带有一些测试链接的帮助文件位于一个子文件夹中。任何地方都可以进行测试,我自己创建了一个 CHM 文件进行测试,链接到 PDF 没有问题。我的 Visual Studio 2015 社区位于 Windows 10 计算机上。

我记得一些 32/64 位问题。请参阅以下链接并注意您需要在 HTML 链接中添加 target = _blank。

https://helpman.it-authoring.com/viewtopic.php?f=30&t=12508

【讨论】:

  • 文件夹位置重要吗?因为我不使用 chm 作为帮助。我像任何程序一样启动它。
  • @tebdilikiyafet ,请检查更新的答案并提供有关在您的应用程序中创建 CHM 链接和用例的更多信息。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-07
  • 1970-01-01
  • 2016-01-24
  • 2021-02-04
  • 1970-01-01
  • 2017-02-03
相关资源
最近更新 更多