看看代码和小 GUI(附上快照)。主题在用户按钮单击后刷新(例如帮助主题1)。
请注意,使用 Microsoft HTMLHelp Workshop 创建的帮助文件可能需要一个自动同步参数。
private void btnHelpTopic1_Click(object sender, EventArgs e)
{
// sHTMLHelpFileName_ShowWithNavigationPane = "CHM-example_ShowWithNavigationPane.chm"
// This is a HelpViewer Window with navigation pane for show case only
// created with Microsoft HTMLHelp Workshop
helpProvider1.HelpNamespace = Application.StartupPath + @"\" + sHTMLHelpFileName_ShowWithNavigationPane;
Help.ShowHelp(this, helpProvider1.HelpNamespace, @"/Garden/tree.htm");
}
private void btnHelpTopic2_Click(object sender, EventArgs e)
{
helpProvider1.HelpNamespace = Application.StartupPath + @"\" + sHTMLHelpFileName_ShowWithNavigationPane;
Help.ShowHelp(this, helpProvider1.HelpNamespace, @"/Garden/flowers.htm");
}
为了下载,我提供了一个 C# VS2008 项目,包括上面的代码和具有不同帮助查看器窗口的帮助文件(不同的 CHM 文件仅用于展示案例)。