共用方式為


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

要設定這個 Help 關鍵字的 Control

navigator
HelpNavigator

其中一個 HelpNavigator 值。

例外狀況

navigator 的值不是其中一個 HelpNavigator 值。

範例

下列程式碼範例示範 如何使用 SetHelpNavigator 方法。

若要執行此範例,請將它放在包含 HelpProvider 具名 HelpProvider1TextBox 具名 TextBox1 的表單中。 此範例需要 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

適用於

另請參閱