toolTipとは? わかりやすく解説

ツールチップ【tooltip】


ToolTip イベント


ToolTip クラス

ユーザーがポインタをコントロール上に配置したときに、そのコントロールの目的の簡単な説明を表示する、小さい四角形のポップアップ ウィンドウを表します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Class ToolTip
    Inherits Component
    Implements IExtenderProvider
public class ToolTip : Component, IExtenderProvider
public ref class ToolTip : public
 Component, IExtenderProvider
public class ToolTip extends Component implements
 IExtenderProvider
public class ToolTip extends
 Component implements IExtenderProvider
解説解説

ToolTip クラスを使用すると、ユーザーがポインタをコントロール上に配置したときに、ユーザーにヒントを提示できます。ToolTip クラスは、通常、コントロールの本来の用途をユーザーに警告するために使用します。たとえば、名前を受け入れる TextBox コントロールには、コントロールに入力する名前の書式を指定するツールヒント テキストを指定できます。ヒントを提示するだけではなく、ToolTip クラスを使用して、実行時のステータス情報も提示できます。たとえば、ToolTip クラスを使用して、インターネットの接続ステータスを表示する PictureBox コントロール上にユーザーがポインタを移動したときに、接続速度と回線の品質に関するデータが表示されるようにできます。

ToolTip クラスは、すべてのコンテナで使用できます。コンテナを明示的に指定するには、ToolTip(IContainer) コンストラクタを使用します。通常、1 つの ToolTip コンポーネントを使用して、1 つのフォーム上にある複数のコントロールのツールヒントを作成します。ToolTip を作成したら、SetToolTip メソッドを個別に呼び出して、ツールヒントの表示テキストを各コントロールに関連付けます。これにより、ユーザーがポインタをコントロール上に配置すると、ツールヒントとそのテキストが表示されるようになります。同じコントロールについて SetToolTip を複数回呼び出すことにより、コントロールに関連付けられたテキストを変更できます。コントロールに関連付けられているテキストを取得するには、GetToolTip メソッドを使用します。ToolTip クラスのインスタンスに関連付けられているすべてのツール ヒント テキストを削除するには、RemoveAll メソッドを使用します。

メモメモ

ツール ヒント テキストは、無効にされているコントロールに対しては表示されません。ShowAlways プロパティが true に設定されている場合を除き、コンテナがアクティブでないときには、ツールヒントは表示されません。

ToolTip クラスには、ツールヒントの既定の動作と外観を変更するために次のプロパティとメソッドが用意されています。

カテゴリ

関連するメンバ

手動による表示

Active, Show, Hide, ShowAlways, Popup, StopTimer

ツールヒントのタイミング

AutoPopDelay, InitialDelay, ReshowDelay, AutomaticDelay, StopTimer

内容

SetToolTip, GetToolTip, StripAmpersands, ToolTipIcon, ToolTipTitle, RemoveAll

外観

BackColor, ForeColor, IsBalloon, OwnerDraw, UseAnimation, UseFading

すべてのツールヒント テキストを無効にすることにより、アプリケーションで表示されないようにするには、Active プロパティを使用します。通常、ツールヒントはオペレーティング システムによって描画されますが、ToolTip の外観をカスタマイズするには、OwnerDraw プロパティを true に設定し、Draw イベントを処理します。

ToolTipTitle クラスは、System.ComponentModel.IExtenderProvider インターフェイスを実装しています。このインターフェイスには、CanExtend という単一のメソッドがあります。ツールヒントは、デザイン時に同じフォーム上のコントロールを拡張し、ToolTip プロパティを追加します。拡張プロバイダの詳細については、「拡張プロバイダ」を参照してください。

使用例使用例

ToolTip クラスのインスタンスを作成し、それを作成した場所である Form に、このインスタンスを関連付けるコード例を次に示します。次に、このコードは AutoPopDelay、InitialDelay、ReshowDelay の各遅延プロパティを初期化します。さらに、ToolTip クラスのインスタンスが ShowAlways プロパティを true に設定して、フォームがアクティブかどうかに関係なく、ツール ヒント テキストを常に表示できるようにします。最後に、ツール ヒント テキストをフォーム上の 2 つのコントロール Button および CheckBox に関連付けます。このコード例では、コード内で定義されたメソッドが、button1 という名前の Button コントロールおよび checkBox1 という名前の CheckBox コントロールを含む Form 内に配置されており、そのメソッドが Form のコンストラクタから呼び出される必要があります。

' 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
// 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.
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.set_AutoPopDelay(5000);
    toolTip1.set_InitialDelay(1000);
    toolTip1.set_ReshowDelay(500);
    // Force the ToolTip text to be displayed whether or not the form
    // is active.
    toolTip1.set_ShowAlways(true);
    // Set up the ToolTip text for the Button and Checkbox.
    toolTip1.SetToolTip(this.button1, "My button1");
    toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
} //Form1_Load
継承階層継承階層
System.Object
   System.MarshalByRefObject
     System.ComponentModel.Component
      System.Windows.Forms.ToolTip
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolTip コンストラクタ ()

コンテナを指定せずに、ToolTip の新しいインスタンスを初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

解説解説
使用例使用例

ToolTip クラスのインスタンスを作成し、それを作成した場所である Form に、このインスタンスを関連付けるコード例を次に示します。次に、このコードは AutoPopDelay、InitialDelay、ReshowDelay の各遅延プロパティを初期化します。また、ToolTip クラスのインスタンスで ShowAlways プロパティを true に設定して、フォームがアクティブかどうかに関係なく、ツール ヒント テキストが表示されるようにします。最後に、ツール ヒント テキストをフォーム上の 2 つのコントロール Button および CheckBox に関連付けます。このコード例では、コード内で定義されたメソッドが、button1 という名前の Button コントロールおよび checkBox1, という名前の CheckBox コントロールを含む Form 内に配置されており、そのメソッドが Form のコンストラクタから呼び出される必要があります。

' 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
// 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.
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.set_AutoPopDelay(5000);
    toolTip1.set_InitialDelay(1000);
    toolTip1.set_ReshowDelay(500);
    // Force the ToolTip text to be displayed whether or not the form
    // is active.
    toolTip1.set_ShowAlways(true);
    // Set up the ToolTip text for the Button and Checkbox.
    toolTip1.SetToolTip(this.button1, "My button1");
    toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
} //Form1_Load
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolTip コンストラクタ (IContainer)

コンテナを指定して、ToolTip クラスの新しいインスタンスを初期化します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Sub New ( _
    cont As IContainer _
)
Dim cont As IContainer

Dim instance As New ToolTip(cont)
public ToolTip (
    IContainer cont
)
public:
ToolTip (
    IContainer^ cont
)
public ToolTip (
    IContainer cont
)
public function ToolTip (
    cont : IContainer
)

パラメータ

cont

ToolTip のコンテナを表す IContainer。

解説解説
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolTip コンストラクタ


ToolTip プロパティ


パブリック プロパティパブリック プロパティ

( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ Active ツール ヒントが現在アクティブかどうかを示す値を取得または設定します。
パブリック プロパティ AutomaticDelay ツール ヒントの自動遅延を取得または設定します。
パブリック プロパティ AutoPopDelay ツールヒント テキストが指定されたコントロール上でポインタが静止している場合に、ツールヒントが表示される時間を取得または設定します。
パブリック プロパティ BackColor ツールヒントの背景色を取得または設定します。
パブリック プロパティ Container  Component を格納している IContainer を取得します。 ( Component から継承されます。)
パブリック プロパティ ForeColor ツールヒントの前景色を取得または設定します。
パブリック プロパティ InitialDelay ツール ヒントが表示されるまでに経過する時間を取得または設定します。
パブリック プロパティ IsBalloon ツールヒントにバルーン ウィンドウを使用するかどうかを示す値を取得または設定します。
パブリック プロパティ OwnerDraw ツールヒントを、オペレーティング システムと独自のコードのどちらによって描画するのかを示す値を取得または設定します。
パブリック プロパティ ReshowDelay ポインタが 1 つのコントロールから別のコントロールに移動したときに、移動先のツールヒント ウィンドウが表示されるまでに経過する必要のある時間の長さを取得または設定します。
パブリック プロパティ ShowAlways 親コントロールがアクティブではない場合でも、ツールヒント ウィンドウを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ Site  Component の ISite を取得または設定します。 ( Component から継承されます。)
パブリック プロパティ StripAmpersands アンパサンド (&) 文字の処理方法を決定する値を取得または設定します。
パブリック プロパティ Tag ToolTip 関連のプログラマが指定した データを格納するオブジェクトを取得または設定します。
パブリック プロパティ ToolTipIcon ツールヒント テキストの横に表示するアイコンの種類を定義する値を取得または設定します。
パブリック プロパティ ToolTipTitle ツールヒント ウィンドウのタイトルを取得または設定します。
パブリック プロパティ UseAnimation ツールヒントを表示するときに、アニメーション効果を使用するかどうかを決定する値を取得または設定します。
パブリック プロパティ UseFading ツールヒントを表示するときに、フェード効果を使用するかどうかを決定する値を取得または設定します。
プロテクト プロパティプロテクト プロパティ
参照参照

関連項目

ToolTip クラス
System.Windows.Forms 名前空間
ToolTipIcon
HelpProvider クラス

その他の技術情報

拡張プロバイダ
ToolTip コンポーネント (Windows フォーム)

ToolTip メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CanExtend ツールヒントが、指定した対象コンポーネントにエクステンダ プロパティを追加できる場合に true を返します。
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド Dispose オーバーロードされます。 ツールヒントによって使用されているリソースを解放します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド GetToolTip 指定したコントロールに関連付けられているツール ヒント テキストを取得します。
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド Hide 指定したツールヒント ウィンドウを非表示にします。
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 ( MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド RemoveAll ツールヒント コンポーネントに現在関連付けられているすべてのツールヒント テキストを削除します。
パブリック メソッド SetToolTip 指定したコントロールにツール ヒント テキストを関連付けます。
パブリック メソッド Show オーバーロードされます。 ツールヒントに関連付けられるテキストを設定し、それを表示します。
パブリック メソッド ToString オーバーライドされます。 このコントロールの文字列形式を返します。
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ToolTip クラス
System.Windows.Forms 名前空間
ToolTipIcon
HelpProvider クラス

その他の技術情報

拡張プロバイダ
ToolTip コンポーネント (Windows フォーム)

ToolTip メンバ

ユーザーがポインタをコントロール上に配置したときに、そのコントロールの目的の簡単な説明を表示する、小さい四角形のポップアップ ウィンドウを表します。

ToolTip データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
パブリック プロパティパブリック プロパティ
( プロテクト プロパティ も参照)
  名前 説明
パブリック プロパティ Active ツール ヒントが現在アクティブかどうかを示す値を取得または設定します。
パブリック プロパティ AutomaticDelay ツール ヒントの自動遅延を取得または設定します。
パブリック プロパティ AutoPopDelay ツールヒント テキストが指定されたコントロール上でポインタが静止している場合に、ツールヒントが表示される時間を取得または設定します。
パブリック プロパティ BackColor ツールヒントの背景色を取得または設定します。
パブリック プロパティ Container  Component を格納している IContainer を取得します。(Component から継承されます。)
パブリック プロパティ ForeColor ツールヒントの前景色を取得または設定します。
パブリック プロパティ InitialDelay ツール ヒントが表示されるまでに経過する時間を取得または設定します。
パブリック プロパティ IsBalloon ツールヒントにバルーン ウィンドウを使用するかどうかを示す値を取得または設定します。
パブリック プロパティ OwnerDraw ツールヒントを、オペレーティング システムと独自のコードのどちらによって描画するのかを示す値を取得または設定します。
パブリック プロパティ ReshowDelay ポインタが 1 つのコントロールから別のコントロールに移動したときに、移動先のツールヒント ウィンドウが表示されるまでに経過する必要のある時間の長さを取得または設定します。
パブリック プロパティ ShowAlways 親コントロールがアクティブではない場合でも、ツールヒント ウィンドウを表示するかどうかを示す値を取得または設定します。
パブリック プロパティ Site  Component の ISite を取得または設定します。(Component から継承されます。)
パブリック プロパティ StripAmpersands アンパサンド (&) 文字の処理方法を決定する値を取得または設定します。
パブリック プロパティ Tag ToolTip 関連のプログラマが指定した データを格納するオブジェクトを取得または設定します。
パブリック プロパティ ToolTipIcon ツールヒント テキストの横に表示するアイコンの種類を定義する値を取得または設定します。
パブリック プロパティ ToolTipTitle ツールヒント ウィンドウのタイトルを取得または設定します。
パブリック プロパティ UseAnimation ツールヒントを表示するときに、アニメーション効果を使用するかどうかを決定する値を取得または設定します。
パブリック プロパティ UseFading ツールヒントを表示するときに、フェード効果を使用するかどうかを決定する値を取得または設定します。
プロテクト プロパティプロテクト プロパティ
パブリック メソッドパブリック メソッド
( プロテクト メソッド も参照)
  名前 説明
パブリック メソッド CanExtend ツールヒントが、指定した対象コンポーネントにエクステンダ プロパティを追加できる場合に true を返します。
パブリック メソッド CreateObjRef  リモート オブジェクトとの通信に使用するプロキシの生成に必要な情報をすべて格納しているオブジェクトを作成します。 (MarshalByRefObject から継承されます。)
パブリック メソッド Dispose オーバーロードされます。 ツールヒントによって使用されているリソースを解放します。
パブリック メソッド Equals  オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。)
パブリック メソッド GetHashCode  特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。)
パブリック メソッド GetLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、現在の有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド GetToolTip 指定したコントロールに関連付けられているツール ヒント テキストを取得します。
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド Hide 指定したツールヒント ウィンドウを非表示にします。
パブリック メソッド InitializeLifetimeService  対象のインスタンスの有効期間ポリシーを制御する、有効期間サービス オブジェクトを取得します。 (MarshalByRefObject から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド RemoveAll ツールヒント コンポーネントに現在関連付けられているすべてのツールヒント テキストを削除します。
パブリック メソッド SetToolTip 指定したコントロールにツール ヒント テキストを関連付けます。
パブリック メソッド Show オーバーロードされます。 ツールヒントに関連付けられるテキストを設定し、それを表示します。
パブリック メソッド ToString オーバーライドされます。 このコントロールの文字列形式を返します。
プロテクト メソッドプロテクト メソッド
パブリック イベントパブリック イベント
参照参照

関連項目

ToolTip クラス
System.Windows.Forms 名前空間
ToolTipIcon
HelpProvider クラス

その他の技術情報

拡張プロバイダ
ToolTip コンポーネント (Windows フォーム)


英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「toolTip」の関連用語

toolTipのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



toolTipのページの著作権

   
デジタル大辞泉デジタル大辞泉
(C)Shogakukan Inc.
株式会社 小学館
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS