ToolTip Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av ToolTip klassen.
Överlagringar
| Name | Description |
|---|---|
| ToolTip() |
Initierar en ny instans av ToolTip utan en angiven container. |
| ToolTip(IContainer) |
Initierar en ny instans av ToolTip klassen med en angiven container. |
ToolTip()
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
Initierar en ny instans av ToolTip utan en angiven container.
public:
ToolTip();
public ToolTip();
Public Sub New ()
Exempel
I följande kodexempel skapas en instans av ToolTip klassen. Koden initierar sedan fördröjningsegenskaperna AutoPopDelay, InitialDelayoch ReshowDelay. Dessutom anger ToolTip instansen ShowAlways av klassen egenskapen till true så att Knappbeskrivningstext kan visas oavsett om formuläret är aktivt. Slutligen associerar exemplet ToolTip-text med två kontroller i ett formulär, en Button och en CheckBox. Kodexemplet kräver att metoden som definieras i exemplet finns i en Form som innehåller en Button kontroll med namnet button1 och en CheckBox kontroll med namnet checkBox1, och att metoden anropas från konstruktorn i 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
Kommentarer
Den här konstruktorn skapar en instans av en Knappbeskrivning som inte är associerad med någon container.
Se även
Gäller för
ToolTip(IContainer)
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
- Källa:
- ToolTip.cs
Initierar en ny instans av ToolTip klassen med en angiven container.
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)
Parametrar
- cont
- IContainer
En IContainer som representerar containern för ToolTip.
Kommentarer
Med ToolTip konstruktorn kan du associera en ToolTip med alla Container objekt. Genom att ToolTip associera på det här sättet lämnar du över kontrollen över livslängden för knappbeskrivningen till Container. Detta kan vara användbart om du använder flera komponenter i programmet och vill ta bort alla på samma gång. Om du till exempel associerar en ToolTip, en ImageListoch en Timer med ett Container, framtvingar anropet DisposeContainer även bortskaffandet av alla dessa komponenter.