Language

ToolTip.AutoPopDelay プロパティ

定義

指定した ToolTip テキストを持つコントロールにポインターが固定されている場合に、ツールヒントが表示されたままの期間を取得または設定します。

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 が表示されたままの時間 (ミリ秒単位)。 Windows 11 では、既定値によってツールヒントが無期限に表示されます。

例

次のコード例では、 ToolTip クラスのインスタンスを作成し、インスタンスをインスタンスが作成された Form に関連付けます。 次に、遅延プロパティ AutoPopDelay、 InitialDelay、および ReshowDelayを初期化します。 さらに、 ToolTip クラスのインスタンスは、フォームがアクティブかどうかに関係なくツールヒント テキストを表示できるように、 ShowAlways プロパティを true に設定します。 最後に、ツールヒント テキストをフォームの 2 つのコントロール ( 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 プロパティは、AutoPopDelay、ReshowDelay、およびInitialDelayのプロパティを 1 つの値に基づいて初期値に設定します。 AutomaticDelay プロパティが設定されるたびに、AutoPopDelay プロパティは AutomaticDelay プロパティ値の 10 倍に設定されます。 AutomaticDelay プロパティが設定されたら、AutoPopDelay プロパティを個別に設定し、既定値をオーバーライドできます。

このプロパティの動作は、Windows のバージョンによって異なります。

  • Windows 10 では、ポップアップを遅延できる最大時間は 5,000 ミリ秒です。 5000 ミリ秒を超える値は、5000 ミリ秒にクランプされます。
  • Windows 11 では、既定値により、ツールヒントは無期限に表示されます。 カスタム値に設定すると、5000 ミリ秒の制限はなく、指定した期間のツールヒントが表示されます。

ツールヒントを表示する時間を長くしたり、正確に制御したりするには、 Show メソッドを使用します。

適用対象

こちらもご覧ください