ToolTip.ShowAlways 屬性

定義

取得或設定值,指出即使父控制項為非現用時,是否也會顯示工具提示視窗。Gets or sets a value indicating whether a ToolTip window is displayed, even when its parent control is not active.

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

屬性值

Boolean

如果要永遠顯示工具提示,則為 true,否則為 falsetrue if the ToolTip is always displayed; otherwise, false. 預設為 falseThe default is false.

範例

下列程式碼範例會建立類別的實例 ToolTip ,並將實例與 Form 建立實例的建立關聯。The following code example creates an instance of the ToolTip class and associates the instance with the Form that the instance is created within. 然後,程式碼會初始化 delay 屬性 AutoPopDelayInitialDelayReshowDelayThe code then initializes the delay properties AutoPopDelay, InitialDelay, and ReshowDelay. 此外,類別的實例 ToolTip 會將屬性設定 ShowAlways 為, true 無論表單是否為使用中,都會顯示工具提示文字。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. 最後,此範例會將工具提示文字與表單、和上的兩個控制項產生關聯 Button CheckBoxFinally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. 程式碼範例需要在包含名為之控制項的中,以及 Form Button button1 CheckBox 名為的控制項 checkBox1 ,以及從的函式呼叫方法時 Form ,範例中所定義的方法。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.
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

備註

ShowAlways您可以使用屬性來顯示工具提示視窗,即使的容器不在作用中 ToolTipWith 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. 當您想要使用來建立控制項時,這項功能也很有用 UserControl ,其中包含顯示工具提示視窗的控制項內的許多控制項。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. 因為 UserControl 通常不是表單上的使用中視窗,所以將這個屬性設定為可 true 讓內的控制項隨時 UserControl 顯示工具提示視窗。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.

適用於

另請參閱