HelpProvider.SetHelpNavigator(Control, HelpNavigator) HelpProvider.SetHelpNavigator(Control, HelpNavigator) HelpProvider.SetHelpNavigator(Control, HelpNavigator) HelpProvider.SetHelpNavigator(Control, HelpNavigator) Method

定义

指定在从帮助文件中检索指定控件的帮助信息时使用的帮助命令。Specifies the Help command to use when retrieving Help from the Help file for the specified control.

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 Control Control

要为其设置帮助关键字的 ControlA Control for which to set the Help keyword.

异常

navigator 值不是 HelpNavigator 值之一。The value of navigator is not one of the HelpNavigator values.

示例

下面的代码示例演示SetHelpNavigator方法的用法。The following code example demonstrates the use of the SetHelpNavigator method.

若要运行此示例, 请将其放在一个HelpProvider包含HelpProvider1名为TextBoxTextBox1和名为的的窗体中。To run this example, place it in a form containing a HelpProvider named HelpProvider1 and a TextBox named TextBox1. 该示例要求在 C:\Windows 目录中存在名为 "输入" 的帮助文件。The example requires the existence of a Help file named input.chm in the C:\Windows directory.

   //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

适用于

另请参阅