ToolTip.ShowAlways 屬性

定義

取得或設定值,指出即使父控制項為非現用時,是否也會顯示工具提示視窗。

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

屬性值

如果要永遠顯示工具提示,則為 true,否則為 false。 預設為 false

範例

下列程式碼範例會建立 類別的實例, ToolTip 並將 實例與 Form 實例建立所在的 相關聯。 然後,程式碼會初始化延遲屬性 AutoPopDelayInitialDelayReshowDelay 。 此外,類別的 ToolTip 實例會將 ShowAlways 屬性設定為 true ,以允許顯示工具提示文字,而不論表單是否為使用中。 最後,此範例會將 ToolTip 文字與表單上的兩個 CheckBox 控制項產生關聯, Button 以及 。 程式碼範例要求範例中定義的方法位於 Form 內,其中包含 Button 名為 button1 的控制項和 CheckBox 名為 checkBox1 的控制項,而且方法是從 的 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使用 屬性時,即使 的 ToolTip 容器未使用中,您仍可顯示工具提示視窗。 您可以在無強制回應視窗應用程式中使用這項功能,讓工具提示視窗顯示,而不論哪一個無強制回應視窗為作用中。 當您想要使用 UserControl 來建立控制項時,此功能也很有用,其中包含一些顯示工具提示視窗的控制項。 UserControl因為 通常不是表單上的使用中視窗,所以將此屬性設定為 true 可讓 內的 UserControl 控制項隨時顯示工具提示視窗。

適用於

另請參閱