ToolTip コンストラクター

定義

ToolTip クラスの新しいインスタンスを初期化します。

オーバーロード

ToolTip()

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

ToolTip(IContainer)

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

ToolTip()

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

public:
 ToolTip();
public ToolTip ();
Public Sub New ()

次のコード例では、クラスのインスタンスを ToolTip 作成します。 次に、遅延プロパティ AutoPopDelayInitialDelayおよび ReshowDelay. さらに、クラスの ToolTip インスタンスは、フォームが ShowAlways アクティブかどうかに関係なく、ToolTip テキストを表示できるようにプロパティ true を設定します。 最後に、ツールヒント テキストをフォームの 2 つのコントロール a と CheckBoxa Button に関連付けます。 このコード例では、この例で定義されているメソッドが、名前付きのコントロールとcheckBox1,CheckBox名前付きのbutton1コントロールを含みButton、メソッドがコンストラクターFormから呼び出されるメソッド内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

注釈

このコンストラクターは、コンテナーに関連付けられていないツールヒントのインスタンスを作成します。

こちらもご覧ください

適用対象

ToolTip(IContainer)

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

public:
 ToolTip(System::ComponentModel::IContainer ^ cont);
public ToolTip (System.ComponentModel.IContainer cont);
new System.Windows.Forms.ToolTip : System.ComponentModel.IContainer -> System.Windows.Forms.ToolTip
Public Sub New (cont As IContainer)

パラメーター

cont
IContainer

IContainer のコンテナーを表す ToolTip

注釈

ToolTipコンストラクターを使用すると、任意ContainerのオブジェクトにToolTip関連付けることができます。 この方法で関連付けること ToolTip により、ツールヒント Containerの有効期間の制御を . これは、アプリケーションで複数のコンポーネントを使用し、それらのすべてを同時に破棄する場合に便利です。 たとえば、a、anImageList、および a ContainerTimer を a に関連付けたToolTip場合、その呼び出しDisposeContainerでは、これらのコンポーネントの破棄も強制されます。

こちらもご覧ください

適用対象