Редагувати

Поділитися через


Help.ShowHelp Method

Definition

Displays the contents of a Help file.

Overloads

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.

ShowHelp(Control, String)

Displays the contents of the Help file at the specified URL.

public:
 static void ShowHelp(System::Windows::Forms::Control ^ parent, System::String ^ url);
public static void ShowHelp (System.Windows.Forms.Control parent, string url);
public static void ShowHelp (System.Windows.Forms.Control? parent, string? url);
static member ShowHelp : System.Windows.Forms.Control * string -> unit
Public Shared Sub ShowHelp (parent As Control, url As String)

Parameters

parent
Control

A Control that identifies the parent of the Help dialog box.

url
String

The path and name of the Help file.

Examples

The following code example demonstrates the ShowHelp method. To run this example, paste the following code into a form that contains a button named Button1.

// Open the Help file for the Character Map topic.  
void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   Help::ShowHelp( TextBox1, "file://c:\\charmap.chm" );
}
// Open the Help file for the Character Map topic.  
private void Button1_Click(System.Object sender, System.EventArgs e)
{

    Help.ShowHelp(TextBox1, "file://c:\\charmap.chm");
}
' Open the Help file for the Character Map topic.  
Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click

    Help.ShowHelp(TextBox1, "file://c:\charmap.chm")
End Sub

Remarks

The url argument can be of the form C:\path\sample.chm or /folder/file.htm. For information on the format of paths, see File path formats on Windows systems.

See also

Applies to

ShowHelp(Control, String, String)

Displays the contents of the Help file found at the specified URL for a specific keyword.

public:
 static void ShowHelp(System::Windows::Forms::Control ^ parent, System::String ^ url, System::String ^ keyword);
public static void ShowHelp (System.Windows.Forms.Control parent, string url, string keyword);
public static void ShowHelp (System.Windows.Forms.Control? parent, string? url, string? keyword);
static member ShowHelp : System.Windows.Forms.Control * string * string -> unit
Public Shared Sub ShowHelp (parent As Control, url As String, keyword As String)

Parameters

parent
Control

A Control that identifies the parent of the Help dialog box.

url
String

The path and name of the Help file.

keyword
String

The keyword to display Help for.

Examples

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 showKeyword_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   
   // Display help using the provided keyword.
   Help::ShowHelp( this, helpfile, keyword->Text );
}
private void showKeyword_Click(object sender, System.EventArgs e)
{
    // Display help using the provided keyword.
    Help.ShowHelp(this, helpfile, keyword.Text);
}
Private Sub showKeyword_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles showKeyword.Click
    ' Display Help using the provided keyword. 
    Help.ShowHelp(Me, helpfile, keyword.Text)
End Sub

Remarks

The url argument can be of the form C:\path\sample.chm or /folder/file.htm. For information on the format of paths, see File path formats on Windows systems.

If keyword is null, the table of contents for the Help file will be displayed.

See also

Applies to

ShowHelp(Control, String, HelpNavigator)

Displays the contents of the Help file found at the specified URL for a specific topic.

public:
 static void ShowHelp(System::Windows::Forms::Control ^ parent, System::String ^ url, System::Windows::Forms::HelpNavigator navigator);
public static void ShowHelp (System.Windows.Forms.Control parent, string url, System.Windows.Forms.HelpNavigator navigator);
public static void ShowHelp (System.Windows.Forms.Control? parent, string? url, System.Windows.Forms.HelpNavigator navigator);
static member ShowHelp : System.Windows.Forms.Control * string * System.Windows.Forms.HelpNavigator -> unit
Public Shared Sub ShowHelp (parent As Control, url As String, navigator As HelpNavigator)

Parameters

parent
Control

A Control that identifies the parent of the Help dialog box.

url
String

The path and name of the Help file.

navigator
HelpNavigator

One of the HelpNavigator values.

Examples

The following code example demonstrates how to use the ShowHelp method to open a Help file to its index page. To run this example, paste the following code into a form that contains a button named Button2.

// Open the Help file for the Character Map topic and 
// display the Index page.
void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   Help::ShowHelp( TextBox1, "file://c:\\charmap.chm", HelpNavigator::Index );
}
// Open the Help file for the Character Map topic and 
// display the Index page.
private void Button2_Click(System.Object sender, System.EventArgs e)
{

    Help.ShowHelp(TextBox1, "file://c:\\charmap.chm", 
        HelpNavigator.Index);
}
' Open the Help file for the Character Map topic and 
' display the Index page.
Private Sub Button2_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click

    Help.ShowHelp(TextBox1, "file://c:\charmap.chm", HelpNavigator.Index)
End Sub

Remarks

The url argument can be of the form C:\path\sample.chm or /folder/file.htm. For information on the format of paths, see File path formats on Windows systems.

Compiled Help files provide table of contents, index, search, and keyword links in pages. You can use the following values for the navigator argument: HelpNavigator.TableOfContents, HelpNavigator.Find, HelpNavigator.Index, or HelpNavigator.Topic.

See also

Applies to

ShowHelp(Control, String, HelpNavigator, Object)

Displays the contents of the Help file located at the URL supplied by the user.

public:
 static void ShowHelp(System::Windows::Forms::Control ^ parent, System::String ^ url, System::Windows::Forms::HelpNavigator command, System::Object ^ param);
public:
 static void ShowHelp(System::Windows::Forms::Control ^ parent, System::String ^ url, System::Windows::Forms::HelpNavigator command, System::Object ^ parameter);
public static void ShowHelp (System.Windows.Forms.Control parent, string url, System.Windows.Forms.HelpNavigator command, object param);
public static void ShowHelp (System.Windows.Forms.Control parent, string url, System.Windows.Forms.HelpNavigator command, object parameter);
public static void ShowHelp (System.Windows.Forms.Control? parent, string? url, System.Windows.Forms.HelpNavigator command, object? parameter);
static member ShowHelp : System.Windows.Forms.Control * string * System.Windows.Forms.HelpNavigator * obj -> unit
static member ShowHelp : System.Windows.Forms.Control * string * System.Windows.Forms.HelpNavigator * obj -> unit
Public Shared Sub ShowHelp (parent As Control, url As String, command As HelpNavigator, param As Object)
Public Shared Sub ShowHelp (parent As Control, url As String, command As HelpNavigator, parameter As Object)

Parameters

parent
Control

A Control that identifies the parent of the Help dialog box.

url
String

The path and name of the Help file.

command
HelpNavigator

One of the HelpNavigator values.

paramparameter
Object

A string that contains the topic identifier.

Exceptions

parameter is an integer.

Examples

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 );
}
private 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 != null)
    {
        navigator = (HelpNavigator)navigatorCombo.SelectedItem;
    }
    Help.ShowHelp(this, helpfile, navigator, parameterTextBox.Text);
}
Private Sub showHelp_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles showHelp.Click
    ' 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.
    Dim navigator As HelpNavigator = HelpNavigator.TableOfContents
    If (navigatorCombo.SelectedItem IsNot Nothing) Then
        navigator = CType(navigatorCombo.SelectedItem, HelpNavigator)
    End If
    Help.ShowHelp(Me, helpfile, navigator, parameterTextBox.Text)
End Sub

Remarks

The url argument can be of the form C:\path\sample.chm or /folder/file.htm. For information on the format of paths, see File path formats on Windows systems.

Compiled Help files provide table-of-contents, index, search, and keyword links in pages. You can use the parameter argument to provide additional refinement of the HelpNavigator.Topic, HelpNavigator.TopicId, HelpNavigator.KeywordIndex, or HelpNavigator.AssociateIndex command. If the value specified in the command argument is HelpNavigator.TableOfContents, HelpNavigator.Index, or HelpNavigator.Find, this value should be an empty string ("", or String.Empty). If the command argument references HelpNavigator.Topic, HelpNavigator.TopicId, HelpNavigator.KeywordIndex, or HelpNavigator.AssociateIndex, this value should be a string that contains the topic name, or the keyword or numeric identifier of the topic to display.

See also

Applies to