在开发过程中,基本都需要实现帮助功能,而一般帮助功能就是打开一个帮助文档,System.Windows.Forms提供了Help类用于打开帮助文档,挺方便的。
Help类提供的方法如下:
Name | Description | |
---|---|---|
ShowHelp(Control, String) | Displays the contents of the Help file at the specified URL. | |
ShowHelp(Control, String, String) | Displays the contents of the Help file found at the specified URL for a specific keyword. | |
ShowHelp(Control, String, HelpNavigator) | Displays the contents of the Help file found at the specified URL for a specific topic. | |
ShowHelp(Control, String, HelpNavigator, Object) | Displays the contents of the Help file located at the URL supplied by the user. | |
ShowHelpIndex | Displays the index of the specified Help file. | |
ShowPopup | Displays a Help pop-up window. |
LZ一般使用ShowHelp(Control, String, HelpNavigator)方法:
System.Windows.Forms.Help.ShowHelp(this, helpFilePath, System.Windows.Forms.HelpNavigator.TableOfContents);
其中,this表示当前的窗体,helpFilePath为帮助文件路径,HelpNavigator指定帮助文件的显示元素。
HelpNavigator:Specifies constants indicating which elements of the Help file to display.
Member name | Description | |
---|---|---|
AssociateIndex | The Help file opens to the index entry for the first letter of a specified topic. | |
Find | The Help file opens to the search page. | |
Index | The Help file opens to the index. | |
KeywordIndex | The Help file opens to the topic with the specified index entry, if one exists; otherwise, the index entry closest to the specified keyword is displayed. | |
TableOfContents | The Help file opens to the table of contents. | |
Topic | The Help file opens to a specified topic, if the topic exists. | |
TopicId | The Help file opens to a topic indicated by a numeric topic identifier. |