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

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?


Have a look at the code and the small GUI (snap attached). The topics are refreshed after the users button click (eg 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");
}

在这里输入图像描述

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


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

链接地址: http://www.djcxy.com/p/71418.html

上一篇: 链接器错误:gcc

下一篇: 如何在CHM文件左侧的树视图中设置选定项目