ToolTip Construtores

Definição

Inicializa uma nova instância da ToolTip classe.

Sobrecargas

Name Description
ToolTip()

Inicializa uma nova instância do ToolTip sem um contentor especificado.

ToolTip(IContainer)

Inicializa uma nova instância da ToolTip classe com um contentor especificado.

ToolTip()

Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs

Inicializa uma nova instância do ToolTip sem um contentor especificado.

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

Exemplos

O seguinte exemplo de código cria uma instância da ToolTip classe. O código inicializa então as propriedades AutoPopDelayde atraso , InitialDelay, e ReshowDelay. Além disso, a instância da ToolTip classe define a ShowAlways propriedade para true permitir que o texto ToolTip seja exibido independentemente de o formulário estar ativo ou não. Finalmente, o exemplo associa o texto ToolTip a dois controlos num formulário, a Button e um CheckBox. O exemplo de código exige que o método definido no exemplo esteja localizado dentro de um Form que contenha um Button controlo nomeado button1 e um CheckBox controlo nomeado checkBox1, e que o método seja chamado do construtor do 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

Observações

Este construtor cria uma instância de uma ToolTip não associada a nenhum contentor.

Ver também

Aplica-se a

ToolTip(IContainer)

Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs
Origem:
ToolTip.cs

Inicializa uma nova instância da ToolTip classe com um contentor especificado.

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)

Parâmetros

cont
IContainer

E IContainer que representa o recipiente do ToolTip.

Observações

O ToolTip construtor permite-lhe associar a ToolTip a qualquer Container objeto. Ao associar o ToolTip desta forma, transfere o controlo da vida útil da ToolTip ao Container. Isto pode ser útil se utilizar vários componentes na sua aplicação e quiser descartá-los todos ao mesmo tempo. Por exemplo, se associar a ToolTip, um ImageList, e a Timer a a Containera , chamar Dispose a , Container também forçará a eliminação de todos estes componentes.

Ver também

Aplica-se a