ToolTip.ShowAlways Propriedade

Definição

Recebe ou define um valor que indica se uma janela ToolTip é exibida, mesmo quando o seu controlo pai não está ativo.

public:
 property bool ShowAlways { bool get(); void set(bool value); };
public bool ShowAlways { get; set; }
member this.ShowAlways : bool with get, set
Public Property ShowAlways As Boolean

Valor de Propriedade

true se a ToolTip estiver sempre exibida; caso contrário, false. A predefinição é false.

Exemplos

O exemplo de código seguinte cria uma instância da ToolTip classe e associa a instância à Form que a instância é criada. 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

Com a ShowAlways propriedade, pode mostrar uma janela de ToolTip mesmo quando o recipiente do ToolTip não está ativo. Pode usar esta funcionalidade numa aplicação de janela sem modo para permitir que as janelas ToolTip sejam exibidas independentemente da janela sem modo ativa. Esta funcionalidade também é útil quando se quer criar um controlo usando o UserControl, que contém vários controlos dentro dele que mostram janelas de ToolTip. Como muitas vezes não UserControl é a janela ativa num formulário, definir esta propriedade para true permitir que os controlos dentro do UserControl mostrem janelas de ToolTip a qualquer momento.

Aplica-se a

Ver também