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 に、このインスタンス関連付けるコード例次に示します次に、このコードAutoPopDelayInitialDelayReshowDelay の各遅延プロパティ初期化します。さらに、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) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ToolTip クラス」の関連用語

ToolTip クラスのお隣キーワード
検索ランキング

   

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



ToolTip クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS