Question

I have a CHM helpfile for my WPF Application. My CHM file contains "htm" files for each page of my application. I want to open the help file for the corresponding page when the user presses F1 on that page. Right now I am able to locate the page and open that page by using the following code:

Help.ShowHelp(this, helpfile, keywordText);

where keywordText contains the URL of my htm file for the selected page.

But the problem is, that the panel on the left side (contents tab in a tree view) is not expanded to the page that opened in the right window. The panel on the left side always remains the same.

How Can I expand the tree view on the left side to the selected page?

Was it helpful?

Solution

Have a look at the code and the small GUI (snap attached). The topics are refreshed after the users button click (e.g. Help Topic1).

Please note the help file created with Microsoft HTMLHelp Workshop may need a auto sync parameter.

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");
}

enter image description here

For download I provide a C# VS2008 Project including the code above and the help files with different help viewer windows (different CHM files for show case only).

OTHER TIPS

Thanks.

The Problem is in the URL.

Before that I gave a URL like this

"Help.CHM::/html/MyHelp.htm"

And when I removed "Help.CHM::/" from the URL and Everything Worked Well..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top