问题
I have a .chm file called help, In that file I have a structure like:
Introduction
-item1
-item2
Topic1
-item1
-item2
Topic2
-item1
-item2
Topic3
Now I want to open Topic1 inside c# or vb.net I have tried:
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.Index, "Topic1")
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.TableOfContents, "Topic1")
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.Topic, "Topic1")
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.KeywordIndex, "Topic1")
but is not working, then I tried to give inside chm file an index to Topic1 (31) and tried:
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.Index, "31")
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.Index, "Item1")
It gives execption, only working code is:
Help.ShowHelp(ParentForm, "Help.chm", HelpNavigator.TableOfContents, Nothing)
How to open Topic1 ?
回答1:
You can use the param parameter to provide further refinement of the Topic, TopicId, KeywordIndex, or AssociateIndex command. If the value specified in the command parameter is TableOfContents, Index, or Find, this value should be an empty string. If the command parameter references Topic, TopicId, KeywordIndex, or AssociateIndex, this value should be a string that contains the topic name, or the keyword or numeric identifier of the topic to display.
So answer was to do:
Help.ShowHelp(ParentForm, "helpFile.chm", "topicURL.htm")
The topicURL Found right clicking on opened topic:
then copy url:
来源:https://stackoverflow.com/questions/19129639/open-specific-part-of-table-of-contents-of-chm-file-c-sharp-or-vb-net