ToolTip.AutoPopDelay 屬性

定義

取得或設定當指標靜止於含指定工具提示文字的控制項上時,工具提示保持可見的時間。

public:
 property int AutoPopDelay { int get(); void set(int value); };
public int AutoPopDelay { get; set; }
member this.AutoPopDelay : int with get, set
Public Property AutoPopDelay As Integer

屬性值

當指標靜止於控制項上時,ToolTip 保持可見的時間 (以毫秒為單位)。 預設值為 5000。

範例

下列程式碼範例會建立 類別的實例, ToolTip 並將 實例與 Form 實例建立所在的 相關聯。 然後,程式碼會初始化延遲屬性 AutoPopDelayInitialDelayReshowDelay 。 此外,類別的 ToolTip 實例會將 屬性設定 ShowAlwaystrue ,以允許顯示工具提示文字,而不論表單是否為使用中。 最後,此範例會將 ToolTip 文字與表單上的兩個控制項建立關聯, Button 以及 CheckBox 。 程式碼範例會要求範例中定義的 方法位於 內 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

備註

屬性 AutoPopDelay 可讓您縮短或延長當指標在控制項上時顯示視窗的時間 ToolTip 。 例如,如果您在工具提示視窗中顯示廣泛的說明,您可以增加此屬性的值,以確保使用者有足夠的時間讀取文字。

如果您想要有工具提示視窗的一致延遲模式,您可以設定 AutomaticDelay 屬性。 屬性會 AutomaticDelay 根據單一值,將 AutoPopDelayReshowDelayInitialDelay 屬性設定為初始值。 每次設定屬性時 AutomaticDelayAutoPopDelay 屬性都會設定為屬性值的 10 倍 AutomaticDelayAutomaticDelay設定屬性之後,您可以獨立設定 AutoPopDelay 屬性,覆寫預設值。

您可以延遲快顯的時間上限為 5000 毫秒。 對於較長的持續時間,請使用 Show 方法來控制顯示工具提示的確切時間。

適用於

另請參閱