次の方法で共有


HelpProvider.SetHelpNavigator メソッド

指定したコントロールのヘルプ ファイルからヘルプを検索するときに使用する、ヘルプ コマンドを指定します。

Public Overridable Sub SetHelpNavigator( _
   ByVal ctl As Control, _   ByVal navigator As HelpNavigator _)
[C#]
public virtual void SetHelpNavigator(Controlctl,HelpNavigatornavigator);
[C++]
public: virtual void SetHelpNavigator(Control* ctl,HelpNavigatornavigator);
[JScript]
public function SetHelpNavigator(
   ctl : Control,navigator : HelpNavigator);

パラメータ

  • ctl
    ヘルプ キーワードの設定対象となる Control
  • navigator
    HelpNavigator 値の 1 つ。

例外

例外の種類 条件
InvalidEnumArgumentException navigator の値が、 HelpNavigator 値の 1 つではありません。

使用例

[Visual Basic, C#] SetHelpNavigator メソッドの例を次に示します。この例を実行するには、HelpProvider1 という名前の HelpProvider と TextBox1 という TextBox が配置されているフォームに、次のコードを貼り付けます。このフォームのコンストラクタまたは Load メソッドで IniInitializeHelpProvider を呼び出します。この例では、c:\windows ディレクトリに input.chm という名前のヘルプ ファイルがあることを前提としています。

 

    'Declare the HelpProvider.
    Friend WithEvents HelpProvider1 As System.Windows.Forms.HelpProvider


    Private Sub InitializeHelpProvider()

        ' Construct the HelpProvider Object.
        Me.HelpProvider1 = New System.Windows.Forms.HelpProvider

        ' Set the HelpNamespace property to the Help file for 
        ' HelpProvider1.
        Me.HelpProvider1.HelpNamespace = "c:\windows\input.chm"

        ' Specify that the Help provider should open to the table
        ' of contents of the Help file.
        Me.HelpProvider1.SetHelpNavigator(TextBox1, _
            HelpNavigator.TableOfContents)

    End Sub

[C#] 

    //Declare the HelpProvider.
    internal System.Windows.Forms.HelpProvider HelpProvider1;


    private void InitializeHelpProvider()
    {
        // Construct the HelpProvider Object.
        this.HelpProvider1 = new System.Windows.Forms.HelpProvider();

        // Set the HelpNamespace property to the Help file for 
        // HelpProvider1.
        this.HelpProvider1.HelpNamespace = "c:\\windows\\input.chm";

        // Specify that the Help provider should open to the table
        // of contents of the Help file.
        this.HelpProvider1.SetHelpNavigator(TextBox1, 
            HelpNavigator.TableOfContents);
    }

[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

HelpProvider クラス | HelpProvider メンバ | System.Windows.Forms 名前空間 | GetHelpString | GetHelpKeyword | GetShowHelp | SetHelpString | SetHelpKeyword