다음을 통해 공유


HelpEventArgs 클래스

정의

HelpRequested 이벤트에 대한 데이터를 제공합니다.

public ref class HelpEventArgs : EventArgs
[System.Runtime.InteropServices.ComVisible(true)]
public class HelpEventArgs : EventArgs
public class HelpEventArgs : EventArgs
[<System.Runtime.InteropServices.ComVisible(true)>]
type HelpEventArgs = class
    inherit EventArgs
type HelpEventArgs = class
    inherit EventArgs
Public Class HelpEventArgs
Inherits EventArgs
상속
HelpEventArgs
특성

예제

다음 예제에서는 처리 된 HelpRequested 4 개 주소 필드가 포함 된 폼에서 사용자 지정 도움말 콘텐츠를 표시 하는 이벤트입니다. HelpRequested 주소 필드에 포커스가 있는 F1 키를 눌러 또는 상황에 맞는 도움말 단추를 사용 하 고 주소 필드에서 도움말 커서를 클릭 하 여 이벤트가 발생 합니다. Handled 나타내려면 true로 설정 합니다 HelpRequested 이벤트를 처리 합니다. 또한 예제에 도움말 텍스트를 저장 합니다 Control.Tag 속성입니다.

#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::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 on any control to give it focus, and then press F1 to display help for that control.  Alternately, you can click the help button at the top of the dialog and then click on a control.";
      
      // 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 = ", ";
      
      // Address TextBox
      this->addressTextBox->Location = System::Drawing::Point( 16, 24 );
      this->addressTextBox->Size = System::Drawing::Size( 264, 20 );
      this->addressTextBox->TabIndex = 0;
      this->addressTextBox->Tag = "Enter the street address in this text box.";
      this->addressTextBox->Text = "";
      this->addressTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested );
      
      // City TextBox
      this->cityTextBox->Location = System::Drawing::Point( 16, 48 );
      this->cityTextBox->Size = System::Drawing::Size( 120, 20 );
      this->cityTextBox->TabIndex = 3;
      this->cityTextBox->Tag = "Enter the city here.";
      this->cityTextBox->Text = "";
      this->cityTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested );
      
      // 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->Tag = "Enter the state in this text box.";
      this->stateTextBox->Text = "";
      this->stateTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested );
      
      // Zip TextBox
      this->zipTextBox->Location = System::Drawing::Point( 192, 48 );
      this->zipTextBox->Name = "zipTextBox";
      this->zipTextBox->Size = System::Drawing::Size( 88, 20 );
      this->zipTextBox->TabIndex = 6;
      this->zipTextBox->Tag = "Enter the zip code here.";
      this->zipTextBox->Text = "";
      this->zipTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested );
      
      // Set up how the form should be displayed and add the controls to the form.
      this->ClientSize = System::Drawing::Size( 292, 160 );
      array<System::Windows::Forms::Control^>^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox};
      this->Controls->AddRange( temp0 );
      this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
      this->HelpButton = true;
      this->MaximizeBox = false;
      this->MinimizeBox = false;
      this->Text = "Help Event Demonstration";
   }


private:
   void textBox_HelpRequested( Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent )
   {
      
      // This event is raised when the F1 key is pressed or the
      // Help cursor is clicked on any of the address fields.
      // The Help text for the field is in the control's
      // Tag property. It is retrieved and displayed in the label.
      Control^ requestingControl = dynamic_cast<Control^>(sender);
      helpLabel->Text = dynamic_cast<String^>(requestingControl->Tag);
      hlpevent->Handled = true;
   }

};


[STAThread]
int main()
{
   Application::Run( gcnew Form1 );
}
using System;
using System.Drawing;
using System.Windows.Forms;

public class Form1 : System.Windows.Forms.Form
{
    private System.Windows.Forms.TextBox addressTextBox;
    private System.Windows.Forms.Label label2;
    private System.Windows.Forms.TextBox cityTextBox;
    private System.Windows.Forms.Label label3;
    private System.Windows.Forms.TextBox stateTextBox;
    private System.Windows.Forms.TextBox zipTextBox;
    private System.Windows.Forms.Label helpLabel;

    [STAThread]
    static void Main() 
    {
        Application.Run(new Form1());
    }

    public Form1()
    {
        this.addressTextBox = new System.Windows.Forms.TextBox();
        this.helpLabel = new System.Windows.Forms.Label();
        this.label2 = new System.Windows.Forms.Label();
        this.cityTextBox = new System.Windows.Forms.TextBox();
        this.label3 = new System.Windows.Forms.Label();
        this.stateTextBox = new System.Windows.Forms.TextBox();
        this.zipTextBox = new System.Windows.Forms.TextBox();

        // Help Label
        this.helpLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
        this.helpLabel.Location = new System.Drawing.Point(8, 80);
        this.helpLabel.Size = new System.Drawing.Size(272, 72);
        this.helpLabel.Text = "Click on any control to give it focus, and then " +
            "press F1 to display help for that control.  Alternately, you can " +
            "click the help button at the top of the dialog and then click on a control.";

        // Address Label
        this.label2.Location = new System.Drawing.Point(16, 8);
        this.label2.Size = new System.Drawing.Size(100, 16);
        this.label2.Text = "Address:";

        // Comma Label
        this.label3.Location = new System.Drawing.Point(136, 56);
        this.label3.Size = new System.Drawing.Size(16, 16);
        this.label3.Text = ",";

        // Address TextBox
        this.addressTextBox.Location = new System.Drawing.Point(16, 24);
        this.addressTextBox.Size = new System.Drawing.Size(264, 20);
        this.addressTextBox.TabIndex = 0;
        this.addressTextBox.Tag = "Enter the street address in this text box.";
        this.addressTextBox.Text = "";
        this.addressTextBox.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.textBox_HelpRequested);

        // City TextBox
        this.cityTextBox.Location = new System.Drawing.Point(16, 48);
        this.cityTextBox.Size = new System.Drawing.Size(120, 20);
        this.cityTextBox.TabIndex = 3;
        this.cityTextBox.Tag = "Enter the city here.";
        this.cityTextBox.Text = "";
        this.cityTextBox.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.textBox_HelpRequested);

        // State TextBox
        this.stateTextBox.Location = new System.Drawing.Point(152, 48);
        this.stateTextBox.MaxLength = 2;
        this.stateTextBox.Size = new System.Drawing.Size(32, 20);
        this.stateTextBox.TabIndex = 5;
        this.stateTextBox.Tag = "Enter the state in this text box.";
        this.stateTextBox.Text = "";
        this.stateTextBox.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.textBox_HelpRequested);

        // Zip TextBox
        this.zipTextBox.Location = new System.Drawing.Point(192, 48);
        this.zipTextBox.Name = "zipTextBox";
        this.zipTextBox.Size = new System.Drawing.Size(88, 20);
        this.zipTextBox.TabIndex = 6;
        this.zipTextBox.Tag = "Enter the zip code here.";
        this.zipTextBox.Text = "";
        this.zipTextBox.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.textBox_HelpRequested);

        // Set up how the form should be displayed and add the controls to the form.
        this.ClientSize = new System.Drawing.Size(292, 160);
        this.Controls.AddRange(new System.Windows.Forms.Control[] { this.zipTextBox, 
                                this.stateTextBox, this.label3, this.cityTextBox,  
                                this.label2, this.helpLabel, this.addressTextBox});

        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        this.HelpButton = true;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Text = "Help Event Demonstration";    
    }

    private void textBox_HelpRequested(object sender, System.Windows.Forms.HelpEventArgs hlpevent)
    {
        // This event is raised when the F1 key is pressed or the
        // Help cursor is clicked on any of the address fields.
        // The Help text for the field is in the control's
        // Tag property. It is retrieved and displayed in the label.

        Control requestingControl = (Control)sender;
        helpLabel.Text = (string)requestingControl.Tag;
        hlpevent.Handled = true;
    }
}
Imports System.Drawing
Imports System.Windows.Forms

Public Class Form1
    Inherits System.Windows.Forms.Form
    Private WithEvents addressTextBox As System.Windows.Forms.TextBox
    Private WithEvents label2 As System.Windows.Forms.Label
    Private WithEvents cityTextBox As System.Windows.Forms.TextBox
    Private WithEvents label3 As System.Windows.Forms.Label
    Private WithEvents stateTextBox As System.Windows.Forms.TextBox
    Private WithEvents zipTextBox As System.Windows.Forms.TextBox
    Private WithEvents helpLabel As System.Windows.Forms.Label

    <STAThread()> _
    Shared Sub Main()
        Application.Run(New Form1)
    End Sub

    Public Sub New()
        Me.addressTextBox = New System.Windows.Forms.TextBox
        Me.helpLabel = New System.Windows.Forms.Label
        Me.label2 = New System.Windows.Forms.Label
        Me.cityTextBox = New System.Windows.Forms.TextBox
        Me.label3 = New System.Windows.Forms.Label
        Me.stateTextBox = New System.Windows.Forms.TextBox
        Me.zipTextBox = New System.Windows.Forms.TextBox

        ' Help Label
        Me.helpLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.helpLabel.Location = New System.Drawing.Point(8, 80)
        Me.helpLabel.Size = New System.Drawing.Size(272, 72)
        Me.helpLabel.Text = "Click on any control to give it focus, and then " & _
            "press F1 to display help for that" + " control.  Alternately, you can " & _
            "click the help button at the top of the dialog and then click on a control."

        ' Address Label
        Me.label2.Location = New System.Drawing.Point(16, 8)
        Me.label2.Size = New System.Drawing.Size(100, 16)
        Me.label2.Text = "Address:"

        ' Comma Label
        Me.label3.Location = New System.Drawing.Point(136, 56)
        Me.label3.Size = New System.Drawing.Size(16, 16)
        Me.label3.Text = ","

        ' Address TextBox
        Me.addressTextBox.Location = New System.Drawing.Point(16, 24)
        Me.addressTextBox.Size = New System.Drawing.Size(264, 20)
        Me.addressTextBox.TabIndex = 0
        Me.addressTextBox.Tag = "Enter the stree address in this text box."
        Me.addressTextBox.Text = ""

        ' City TextBox
        Me.cityTextBox.Location = New System.Drawing.Point(16, 48)
        Me.cityTextBox.Size = New System.Drawing.Size(120, 20)
        Me.cityTextBox.TabIndex = 3
        Me.cityTextBox.Tag = "Enter the city here."
        Me.cityTextBox.Text = ""

        ' State TextBox
        Me.stateTextBox.Location = New System.Drawing.Point(152, 48)
        Me.stateTextBox.MaxLength = 2
        Me.stateTextBox.Size = New System.Drawing.Size(32, 20)
        Me.stateTextBox.TabIndex = 5
        Me.stateTextBox.Tag = "Enter the state in this text box."
        Me.stateTextBox.Text = ""

        ' Zip TextBox
        Me.zipTextBox.Location = New System.Drawing.Point(192, 48)
        Me.zipTextBox.Size = New System.Drawing.Size(88, 20)
        Me.zipTextBox.TabIndex = 6
        Me.zipTextBox.Tag = "Enter the zip code here."
        Me.zipTextBox.Text = ""

        ' Set up how the form should be displayed and add the controls to the form.
        Me.ClientSize = New System.Drawing.Size(292, 160)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.zipTextBox, _
                                Me.stateTextBox, Me.label3, Me.cityTextBox, _
                                Me.label2, Me.helpLabel, Me.addressTextBox})
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.HelpButton = True
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Text = "Help Event Demonstration"
    End Sub

    Private Sub textBox_HelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles addressTextBox.HelpRequested, cityTextBox.HelpRequested, stateTextBox.HelpRequested, zipTextBox.HelpRequested
        ' This event is raised when the F1 key is pressed or the
        ' Help cursor is clicked on any of the address fields.
        ' The Help text for the field is in the control's
        ' Tag property. It is retrieved and displayed in the label.

        Dim requestingControl As Control = CType(sender, Control)
        helpLabel.Text = CStr(requestingControl.Tag)
        hlpevent.Handled = True

    End Sub
End Class

설명

이벤트는 HelpRequested 사용자가 컨트롤에 대한 도움말을 요청할 때 발생합니다. 개체는 HelpEventArgs 마우스 포인터의 화면 좌표와 이벤트가 처리되었는지 여부를 지정합니다.

이벤트 모델에 대 한 자세한 내용은 이벤트 처리 및 발생합니다.

생성자

HelpEventArgs(Point)

HelpEventArgs 클래스의 새 인스턴스를 초기화합니다.

속성

Handled

Help 이벤트가 처리되었는지 여부를 나타내는 값을 가져오거나 설정합니다.

MousePos

마우스 포인터의 화면 좌표를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보