Winforms HelperProvider始终打开索引文件

Winforms HelperProvider始终打开索引文件,winforms,chm,context-sensitive-help,Winforms,Chm,Context Sensitive Help,我想为winforms应用程序构建一个上下文相关帮助,为此,我使用了一个引用HelperProvider组件的类,HelpNamespace被设置为索引html文件,当加载表单时,我使用从配置文件获得的主题将表单中的每个控件注册到HelperProvider: helpProvider.SetShowHelp(control, true); helpProvider.SetHelpNavigator(control, helpNavigator); helpPro

我想为winforms应用程序构建一个上下文相关帮助,为此,我使用了一个引用HelperProvider组件的类,HelpNamespace被设置为索引html文件,当加载表单时,我使用从配置文件获得的主题将表单中的每个控件注册到HelperProvider:

helpProvider.SetShowHelp(control, true);
        helpProvider.SetHelpNavigator(control, helpNavigator);
        helpProvider.SetHelpKeyword(control, helpKeyword);
调试时,我确信某些控件配置的主题与索引文件不同,但在运行并按F1键时,它始终是打开的索引文件(HelpNamespace)。当为每个控件使用HelperProvider实例,而不是为所有控件使用单个实例时,效果很好!
为什么不能对所有控件使用一个helperProvider实例?

每个控件都需要SetHelpKeyword。HelpNavigator.TopicId对于包含主题ID的CHM可能很有用

我在上面的代码示例中缺少“.Topic”。请尝试下面的代码或从下载一个工作示例:


每个控件都需要SetHelpKeyword。HelpNavigator.TopicId对于包含主题ID的CHM可能很有用

我在上面的代码示例中缺少“.Topic”。请尝试下面的代码或从下载一个工作示例:


谢谢你的回复!请务必仔细阅读本手册。另外请注意,每次链接到自己的网站/产品时,都需要发布免责声明。感谢您发布您的答案!请务必仔细阅读本手册。还请注意,每次链接到自己的网站/产品时,都需要发布免责声明。
            // set F1 help topic for controls on this form
        helpProvider1.SetHelpNavigator(this.btnStart, HelpNavigator.Topic);
        helpProvider1.SetHelpKeyword(this.btnStart, @"/Garden/flowers.htm");
        helpProvider1.SetHelpNavigator(this.btnExit, HelpNavigator.Topic);
        helpProvider1.SetHelpKeyword(this.btnExit, @"/Garden/tree.htm");
        helpProvider1.SetHelpNavigator(this.chkShowHelpWithNavigationPane, HelpNavigator.Topic);
        helpProvider1.SetHelpKeyword(this.chkShowHelpWithNavigationPane, @"/HTMLHelp_Examples/jump_to_anchor.htm#AnchorSample");