HelpProvider Class
Provides pop-up or online Help for controls.
System::MarshalByRefObject
System.ComponentModel::Component
System.Windows.Forms::HelpProvider
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The HelpProvider type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component.) |
![]() | Container | Gets the IContainer that contains the Component. (Inherited from Component.) |
![]() | DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component.) |
![]() | Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component.) |
![]() | HelpNamespace | Gets or sets a value specifying the name of the Help file associated with this HelpProvider object. |
![]() | Site | Gets or sets the ISite of the Component. (Inherited from Component.) |
![]() | Tag | Gets or sets the object that contains supplemental data about the HelpProvider. |
| Name | Description | |
|---|---|---|
![]() | CanExtend | Specifies whether this object can provide its extender properties to the specified object. |
![]() | CreateObjRef | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.) |
![]() | Dispose() | Releases all resources used by the Component. (Inherited from Component.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetHelpKeyword | Returns the Help keyword for the specified control. |
![]() | GetHelpNavigator | Returns the current HelpNavigator setting for the specified control. |
![]() | GetHelpString | Returns the contents of the pop-up Help window for the specified control. |
![]() | GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | GetService | Returns an object that represents a service provided by the Component or by its Container. (Inherited from Component.) |
![]() | GetShowHelp | Returns a value indicating whether the specified control's Help should be displayed. |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.) |
![]() | ResetShowHelp | Infrastructure. Removes the Help associated with the specified control. |
![]() | SetHelpKeyword | Specifies the keyword used to retrieve Help when the user invokes Help for the specified control. |
![]() | SetHelpNavigator | Specifies the Help command to use when retrieving Help from the Help file for the specified control. |
![]() | SetHelpString | Specifies the Help string associated with the specified control. |
![]() | SetShowHelp | Specifies whether Help is displayed for the specified control. |
![]() | ToString | Infrastructure. Returns a string that represents the current HelpProvider. (Overrides Component::ToString().) |
Each instance of HelpProvider maintains a collection of references to controls associated with it. To associate a Help file with the HelpProvider, set the HelpNamespace property. You specify the type of Help provided by calling the SetHelpNavigator method and providing a HelpNavigator value for the specified control. You provide the keyword or topic for the Help by calling the SetHelpKeyword method. To open Help to a specific topic, the keyword should be passed in the form topicName.htm.
To associate a specific Help string with a control, use the SetHelpString method. The string that you associate with a control using this method is displayed in a pop-up window when the user presses the F1 key while the control has focus.
If the HelpNamespace property has not been set, you must use the SetHelpString method to provide the Help text. If you have set both HelpNamespace and the Help string, Help based on the HelpNamespace will take precedence.
HelpProvider calls methods on the Help class to provide Help functionality.
The following code example demonstrates using the HelpProvider class to display context-sensitive Help on a form containing four address fields. The example uses the SetHelpString method to set the Help ToolTip text. When you use the context-sensitive Help button and click the Help cursor on an address field, the Help ToolTip appears with the specified text. When you press the F1 key with the focus in an address field, the mspaint.chm Help file is displayed because the HelpNamespace property has been set to mspaint.chm. The SetShowHelp method is called for each address control to identify that it has Help content available.
#using <System.dll> #using <System.Windows.Forms.dll> #using <System.Drawing.dll> using namespace System; using namespace System::Drawing; using namespace System::Windows::Forms; public ref class Form1: public System::Windows::Forms::Form { private: System::Windows::Forms::TextBox^ addressTextBox; System::Windows::Forms::Label ^ label2; System::Windows::Forms::TextBox^ cityTextBox; System::Windows::Forms::Label ^ label3; System::Windows::Forms::TextBox^ stateTextBox; System::Windows::Forms::TextBox^ zipTextBox; System::Windows::Forms::HelpProvider^ helpProvider1; System::Windows::Forms::Label ^ helpLabel; public: Form1() { this->addressTextBox = gcnew System::Windows::Forms::TextBox; this->helpLabel = gcnew System::Windows::Forms::Label; this->label2 = gcnew System::Windows::Forms::Label; this->cityTextBox = gcnew System::Windows::Forms::TextBox; this->label3 = gcnew System::Windows::Forms::Label; this->stateTextBox = gcnew System::Windows::Forms::TextBox; this->zipTextBox = gcnew System::Windows::Forms::TextBox; // Help Label this->helpLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; this->helpLabel->Location = System::Drawing::Point( 8, 80 ); this->helpLabel->Size = System::Drawing::Size( 272, 72 ); this->helpLabel->Text = "Click the Help button in the title bar, then click a control to see a Help tooltip for the control. Click on a control and press F1 to invoke the Help system with a sample Help file."; // Address Label this->label2->Location = System::Drawing::Point( 16, 8 ); this->label2->Size = System::Drawing::Size( 100, 16 ); this->label2->Text = "Address:"; // Comma Label this->label3->Location = System::Drawing::Point( 136, 56 ); this->label3->Size = System::Drawing::Size( 16, 16 ); this->label3->Text = ", "; // Create the HelpProvider. this->helpProvider1 = gcnew System::Windows::Forms::HelpProvider; // Tell the HelpProvider what controls to provide help for, and // what the help String* is. this->helpProvider1->SetShowHelp( this->addressTextBox, true ); this->helpProvider1->SetHelpString( this->addressTextBox, "Enter the street address in this text box." ); this->helpProvider1->SetShowHelp( this->cityTextBox, true ); this->helpProvider1->SetHelpString( this->cityTextBox, "Enter the city here." ); this->helpProvider1->SetShowHelp( this->stateTextBox, true ); this->helpProvider1->SetHelpString( this->stateTextBox, "Enter the state in this text box." ); this->helpProvider1->SetShowHelp( this->zipTextBox, true ); this->helpProvider1->SetHelpString( this->zipTextBox, "Enter the zip code here." ); // Set what the Help file will be for the HelpProvider. this->helpProvider1->HelpNamespace = "mspaint.chm"; // Sets properties for the different address fields. // Address TextBox this->addressTextBox->Location = System::Drawing::Point( 16, 24 ); this->addressTextBox->Size = System::Drawing::Size( 264, 20 ); this->addressTextBox->TabIndex = 0; this->addressTextBox->Text = ""; // City TextBox this->cityTextBox->Location = System::Drawing::Point( 16, 48 ); this->cityTextBox->Size = System::Drawing::Size( 120, 20 ); this->cityTextBox->TabIndex = 3; this->cityTextBox->Text = ""; // State TextBox this->stateTextBox->Location = System::Drawing::Point( 152, 48 ); this->stateTextBox->MaxLength = 2; this->stateTextBox->Size = System::Drawing::Size( 32, 20 ); this->stateTextBox->TabIndex = 5; this->stateTextBox->Text = ""; // Zip TextBox this->zipTextBox->Location = System::Drawing::Point( 192, 48 ); this->zipTextBox->Size = System::Drawing::Size( 88, 20 ); this->zipTextBox->TabIndex = 6; this->zipTextBox->Text = ""; // Add the controls to the form. array<System::Windows::Forms::Control^>^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox}; this->Controls->AddRange( temp0 ); // Set the form to look like a dialog, and show the HelpButton. this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; this->HelpButton = true; this->MaximizeBox = false; this->MinimizeBox = false; this->ClientSize = System::Drawing::Size( 292, 160 ); this->Text = "Help Provider Demonstration"; } }; [STAThread] int main() { Application::Run( gcnew Form1 ); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
