ToolTip Konstruktory

Definicja

Inicjuje nowe wystąpienie klasy ToolTip.

Przeciążenia

ToolTip()

Inicjuje nowe wystąpienie kontenera ToolTip bez określonego kontenera.

ToolTip(IContainer)

Inicjuje ToolTip nowe wystąpienie klasy z określonym kontenerem.

ToolTip()

Inicjuje nowe wystąpienie kontenera ToolTip bez określonego kontenera.

public:
 ToolTip();
public ToolTip ();
Public Sub New ()

Przykłady

Poniższy przykład kodu tworzy wystąpienie ToolTip klasy. Następnie kod inicjuje właściwości AutoPopDelayopóźnienia , InitialDelayi ReshowDelay. Ponadto wystąpienie ToolTip klasy ustawia ShowAlways właściwość w celu true włączenia wyświetlania tekstu etykietki narzędzia niezależnie od tego, czy formularz jest aktywny. Na koniec przykład kojarzy tekst etykietki narzędzia z dwoma kontrolkami w formularzu, a Button i .CheckBox Przykład kodu wymaga, aby metoda zdefiniowana w przykładzie znajdowała się w obiekcie Form zawierającym kontrolkę Button o nazwie i kontrolce CheckBox o nazwie checkBox1, button1 i że metoda jest wywoływana z konstruktora Formklasy .

// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
void Form1_Load( Object^ sender, System::EventArgs^ e )
{
   // Create the ToolTip and associate with the Form container.
   ToolTip^ toolTip1 = gcnew ToolTip;
   
   // Set up the delays for the ToolTip.
   toolTip1->AutoPopDelay = 5000;
   toolTip1->InitialDelay = 1000;
   toolTip1->ReshowDelay = 500;
   // Force the ToolTip text to be displayed whether or not the form is active.
   toolTip1->ShowAlways = true;
   
   // Set up the ToolTip text for the Button and Checkbox.
   toolTip1->SetToolTip( this->button1, "My button1" );
   toolTip1->SetToolTip( this->checkBox1, "My checkBox1" );
}
// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
private void Form1_Load(object sender, System.EventArgs e)
{
   // Create the ToolTip and associate with the Form container.
   ToolTip toolTip1 = new ToolTip();

   // Set up the delays for the ToolTip.
   toolTip1.AutoPopDelay = 5000;
   toolTip1.InitialDelay = 1000;
   toolTip1.ReshowDelay = 500;
   // Force the ToolTip text to be displayed whether or not the form is active.
   toolTip1.ShowAlways = true;
      
   // Set up the ToolTip text for the Button and Checkbox.
   toolTip1.SetToolTip(this.button1, "My button1");
   toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}
' This example assumes that the Form_Load event handling method
' is connected to the Load event of the form.
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
   ' Create the ToolTip and associate with the Form container.
   Dim toolTip1 As New ToolTip()
   
   ' Set up the delays for the ToolTip.
   toolTip1.AutoPopDelay = 5000
   toolTip1.InitialDelay = 1000
   toolTip1.ReshowDelay = 500
   ' Force the ToolTip text to be displayed whether or not the form is active.
   toolTip1.ShowAlways = True
   
   ' Set up the ToolTip text for the Button and Checkbox.
   toolTip1.SetToolTip(Me.button1, "My button1")
   toolTip1.SetToolTip(Me.checkBox1, "My checkBox1")
End Sub

Uwagi

Ten konstruktor tworzy wystąpienie etykietki narzędzia, które nie jest skojarzone z żadnym kontenerem.

Zobacz też

Dotyczy

ToolTip(IContainer)

Inicjuje ToolTip nowe wystąpienie klasy z określonym kontenerem.

public:
 ToolTip(System::ComponentModel::IContainer ^ cont);
public ToolTip (System.ComponentModel.IContainer cont);
new System.Windows.Forms.ToolTip : System.ComponentModel.IContainer -> System.Windows.Forms.ToolTip
Public Sub New (cont As IContainer)

Parametry

cont
IContainer

Element IContainer reprezentujący kontener elementu ToolTip.

Uwagi

Konstruktor ToolTip umożliwia skojarzenie obiektu z dowolnym Container obiektemToolTip. Kojarząc element ToolTip w ten sposób, przekazujesz kontrolę okresu istnienia etykietki narzędzia do elementu Container. Może to być przydatne, jeśli używasz kilku składników w aplikacji i chcesz usunąć wszystkie z nich w tym samym czasie. Jeśli na przykład skojarzysz ToolTipelement , ImageListi Timer z elementem Container, wywołanie Dispose Container metody spowoduje również wymuszenie usunięcia wszystkich tych składników.

Zobacz też

Dotyczy