HelpProvider.SetHelpNavigator(Control, HelpNavigator) 方法

定义

指定在从帮助文件中检索指定控件的帮助信息时使用的帮助命令。

public:
 virtual void SetHelpNavigator(System::Windows::Forms::Control ^ ctl, System::Windows::Forms::HelpNavigator navigator);
public virtual void SetHelpNavigator (System.Windows.Forms.Control ctl, System.Windows.Forms.HelpNavigator navigator);
abstract member SetHelpNavigator : System.Windows.Forms.Control * System.Windows.Forms.HelpNavigator -> unit
override this.SetHelpNavigator : System.Windows.Forms.Control * System.Windows.Forms.HelpNavigator -> unit
Public Overridable Sub SetHelpNavigator (ctl As Control, navigator As HelpNavigator)

参数

ctl
Control

要为其设置帮助关键字的 Control

navigator
HelpNavigator

HelpNavigator 值之一。

例外

navigator 值不是 HelpNavigator 值之一。

示例

下面的代码示例演示如何使用 SetHelpNavigator 方法。

若要运行此示例,请将其置于包含HelpProvider命名和TextBox命名 HelpProvider1TextBox1的窗体中。 该示例要求 C:\Windows 目录中存在名为 input.chm 的帮助文件。

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

private:
   void InitializeHelpProvider()
   {
      // Construct the HelpProvider Object.
      this->HelpProvider1 = gcnew 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 );
   }

//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);
}

'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

适用于

另请参阅