Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


ToolTip.ShowAlways Property

Definition

Gets or sets a value indicating whether a ToolTip window is displayed, even when its parent control is not active.

public bool ShowAlways { get; set; }

Property Value

true if the ToolTip is always displayed; otherwise, false. The default is false.

Examples

The following code example creates an instance of the ToolTip class and associates the instance with the Form that the instance is created within. The code then initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay. In addition the instance of the ToolTip class sets the ShowAlways property to true to enable ToolTip text to be displayed regardless of whether the form is active. Finally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. The code example requires that the method defined in the example is located within a Form that contains a Button control named button1 and a CheckBox control named checkBox1, and that the method is called from the constructor of the Form.

// 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");
}

Remarks

With the ShowAlways property, you can display a ToolTip window even when the container of the ToolTip is not active. You can use this feature in a modeless window application to enable ToolTip windows to be displayed regardless of which modeless window is active. This feature is also useful when you want to create a control by using the UserControl, which contains a number of controls within it that display ToolTip windows. Because the UserControl is often not the active window on a form, setting this property to true enables the controls within the UserControl to display ToolTip windows at any time.

Applies to

Termék Verziók
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also