ToolTip.AutoPopDelay ToolTip.AutoPopDelay ToolTip.AutoPopDelay ToolTip.AutoPopDelay Property

定义

获取或设置当指针在具有指定工具提示文本的控件内保持静止时,工具提示保持可见的时间期限。Gets or sets the period of time the ToolTip remains visible if the pointer is stationary on a control with specified ToolTip text.

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 保持可见的时间期限(以毫秒为单位)。The period of time, in milliseconds, that the ToolTip remains visible when the pointer is stationary on a control. 默认值为 5000。The default value is 5000.

示例

下面的代码示例创建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. 然后, 该代码初始化延迟属性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两个控件 ( CheckBox和) 相关联。Finally, the example associates ToolTip text with two controls on a form, a Button and a CheckBox. 此代码示例要求在示例中定义的Form方法位于Button包含名为button1的控件和CheckBoxcheckBox1,为的控件以及从构造函数中调用方法的FormThe 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

注解

AutoPopDelay指针位于控件上时, 可以使用属性来缩短ToolTip或延长窗口的显示时间。The AutoPopDelay property enables you to shorten or lengthen the time that the ToolTip window is displayed when the pointer is on a control. 例如, 如果在工具提示窗口中显示广泛的帮助, 则可以增大此属性的值, 以确保用户有足够的时间来读取文本。For example, if you display extensive Help in a ToolTip window, you can increase the value of this property to ensure that the user has sufficient time to read the text.

如果要为 "工具提示" 窗口设置一致的延迟模式, 可以设置AutomaticDelay属性。If you want to have a consistent delay pattern for your ToolTip windows, you can set the AutomaticDelay property. AutomaticDelay 属性AutoPopDelay将、ReshowDelay和属性InitialDelay设置为基于单个值的初始值。The AutomaticDelay property sets the AutoPopDelay, ReshowDelay, and InitialDelay properties to initial values based on a single value. 每次设置AutomaticDelay此属性时AutoPopDelay , 属性将设置为属性值的AutomaticDelay 10 倍。Every time the AutomaticDelay property is set, the AutoPopDelay property is set to 10 times the AutomaticDelay property value. 设置属性后, 可以单独AutoPopDelay设置属性, 重写默认值。 AutomaticDelayOnce the AutomaticDelay property is set, you can independently set the AutoPopDelay property, overriding the default value.

弹出窗口延迟的最长时间为5000毫秒。The maximum time you can delay a popup is 5000 milliseconds. 对于更长的持续时间Show , 请使用方法来控制显示工具提示的确切时刻。For longer durations, use the Show method to control the exact moment when the ToolTip is displayed.

适用于

另请参阅