Help::ShowHelp Method (Control^, String^, HelpNavigator, Object^)
Displays the contents of the Help file located at the URL supplied by the user.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
public: static void ShowHelp( Control^ parent, String^ url, HelpNavigator command, Object^ parameter )
Parameters
- parent
-
Type:
System.Windows.Forms::Control^
A Control that identifies the parent of the Help dialog box.
- url
-
Type:
System::String^
The path and name of the Help file.
- command
-
Type:
System.Windows.Forms::HelpNavigator
One of the HelpNavigator values.
- parameter
-
Type:
System::Object^
A string that contains the topic identifier.
| Exception | Condition |
|---|---|
| ArgumentException | parameter is an integer. |
Compiled Help files provide table-of-contents, index, search, and keyword links in pages. You can use the param parameter to provide additional 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.
The url parameter can be of the form C:\path\sample.chm or /folder/file.htm.
The following code example displays a form with three buttons that can be used to interact with the mspaint.chm Help file. The Show Help Index button displays the Index tab for the Help file. The Show Help button displays content in the Help file based on the value that is selected in the Help Navigator list. The Show Keyword button displays content in the Help file based on the keyword that is specified in the Keyword text box.
For example, to show the Ovals Help page by the index value, select the HelpNavigator::KeywordIndex value in the Help Navigator drop-down list, type ovals in the Parameter text box, and then click the Show Help button. To show the "To paint with a brush" Help topic by the keyword, type mspaint.chm::/paint_brush.htm in the Keyword text box, and then click the Show Keyword button.
This example shows only the call to the ShowHelp method. See the Help class overview for the complete code example.
void showHelp_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { // Display Help using the Help navigator enumeration // that is selected in the combo box. Some enumeration // values make use of an extra parameter, which can // be passed in through the Parameter text box. HelpNavigator navigator = HelpNavigator::TableOfContents; if ( navigatorCombo->SelectedItem != nullptr ) { navigator = *safe_cast<HelpNavigator^>(navigatorCombo->SelectedItem); } Help::ShowHelp( this, helpfile, navigator, parameterTextBox->Text ); }
for accessing an HTML Help file through an HTTP request. Associated enumeration: NetworkAccess::Connect
for accessing an HTML Help file not served from an HTTP server. Associated enumeration: UnmanagedCode
Available since 1.1