次の方法で共有


ToolTip コンストラクター

定義

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

オーバーロード

名前 説明
ToolTip()

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

ToolTip(IContainer)

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

ToolTip()

ソース:
ToolTip.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs

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

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

次のコード例では、 ToolTip クラスのインスタンスを作成します。 次に、遅延プロパティ AutoPopDelayInitialDelay、および ReshowDelayを初期化します。 さらに、 ToolTip クラスのインスタンスは、フォームがアクティブかどうかに関係なくツールヒント テキストを表示できるように、 ShowAlways プロパティを true に設定します。 最後に、ツールヒント テキストをフォームの 2 つのコントロール ( ButtonCheckBox) に関連付けます。 このコード例では、この例で定義されているメソッドが、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.
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.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs
ソース:
ToolTip.cs

指定したコンテナーを使用して、 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

ToolTipのコンテナーを表すIContainer

注釈

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

こちらもご覧ください

適用対象