ToolTip Constructeurs

Définition

Initialise une nouvelle instance de la classe ToolTip.

Surcharges

ToolTip()

Initialise une nouvelle instance de la classe ToolTip sans conteneur spécifié.

ToolTip(IContainer)

Initialise une nouvelle instance de la classe ToolTip avec un conteneur spécifié.

ToolTip()

Initialise une nouvelle instance de la classe ToolTip sans conteneur spécifié.

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

Exemples

L’exemple de code suivant crée une instance de la ToolTip classe. Le code initialise ensuite les propriétés AutoPopDelayde retard, InitialDelayet ReshowDelay. En outre, l’instance de la ToolTip classe définit la propriété pour true activer l’affichage ShowAlways du texte ToolTip, quel que soit le formulaire actif. Enfin, l’exemple associe du texte Info-bulle à deux contrôles sur un formulaire, un Button et un CheckBox. L’exemple de code nécessite que la méthode définie dans l’exemple se trouve dans un Button Form contrôle nommé et un CheckBox contrôle nommé button1 checkBox1, et que la méthode est appelée à partir du constructeur du Form.

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

Remarques

Ce constructeur crée une instance d’une info-bulle qui n’est associée à aucun conteneur.

Voir aussi

S’applique à

ToolTip(IContainer)

Initialise une nouvelle instance de la classe ToolTip avec un conteneur spécifié.

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)

Paramètres

cont
IContainer

IContainer qui représente le conteneur de ToolTip.

Remarques

Le ToolTip constructeur vous permet d’associer un ToolTip objet à n’importe quel Container objet. En associant cette ToolTip façon, vous passez le contrôle de la durée de vie de l’info-bulle à l’info-bulle Container. Cela peut être utile si vous utilisez plusieurs composants dans votre application et que vous souhaitez les supprimer en même temps. Par exemple, si vous associez un ToolTip, un ImageListet un Timer à un Container, appelant Dispose sur le Container point de forcer l’élimination de tous ces composants.

Voir aussi

S’applique à