Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the Selected item in the tree view on the Left side of CHM file

Tags:

c#

winforms

wpf

chm

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?

like image 488
Roshil K Avatar asked May 08 '13 11:05

Roshil K


2 Answers

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).

like image 113
help-info.de Avatar answered Nov 08 '22 04:11

help-info.de


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..

like image 1
Roshil K Avatar answered Nov 08 '22 04:11

Roshil K