ToolTip.InitialDelay 屬性

定義

取得或設定在工具提示出現之前,所經過的時間。

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

屬性值

Int32

在顯示工具提示視窗之前,指標必須保持靜止在控制項上的時間 (以毫秒為單位)。

範例

下列程式碼範例會建立 類別的實例, 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

備註

InitialDelay使用 屬性,您可以縮短或延長在顯示工具提示視窗之前等候的時間 ToolTip 。 如果屬性的值 InitialDelay 設定為持續時間太長的值,應用程式的使用者可能不知道您的應用程式提供工具提示說明。 您可以使用這個屬性,藉由縮短指定的時間,確保使用者快速顯示工具提示。

此屬性的值不能超過 32767。

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

適用於

另請參閱