ToolTip.ShowAlways Proprietà

Definizione

Ottiene o imposta un valore che indica se una finestra della descrizione comando viene visualizzata anche quando il relativo controllo padre non è attivo.

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

Valore della proprietà

true se la descrizione comandi è sempre visualizzata; in caso contrario, false. Il valore predefinito è false.

Esempio

Nell'esempio di codice seguente viene creata un'istanza della ToolTip classe e viene associata l'istanza all'oggetto Form in cui viene creata l'istanza. Il codice inizializza quindi le proprietà AutoPopDelaydi ritardo , InitialDelaye ReshowDelay. Inoltre, l'istanza della ToolTip classe imposta la ShowAlways proprietà su per true consentire la visualizzazione del testo della descrizione comando indipendentemente dal fatto che il modulo sia attivo. Infine, l'esempio associa il testo della descrizione comando a due controlli di una maschera, un oggetto Button e un oggetto CheckBox. L'esempio di codice richiede che il metodo definito nell'esempio si trovi all'interno di un Form oggetto che contiene un Button controllo denominato e un CheckBox controllo denominato button1checkBox1e che il metodo viene chiamato dal costruttore di 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

Commenti

Con la ShowAlways proprietà è possibile visualizzare una finestra Descrizione comando anche quando il contenitore di ToolTip non è attivo. È possibile usare questa funzionalità in un'applicazione finestra senza modalità per abilitare la visualizzazione delle finestre della descrizione comando indipendentemente dalla finestra in modalità attiva. Questa funzionalità è utile anche quando si desidera creare un controllo usando , UserControlche contiene un numero di controlli all'interno di esso che visualizzano le finestre Descrizione comando. Poiché spesso UserControl non è la finestra attiva di una maschera, l'impostazione di questa proprietà su true consente ai controlli all'interno UserControl di per visualizzare le finestre della descrizione comando in qualsiasi momento.

Si applica a

Vedi anche