PopupEventArgs.AssociatedControl プロパティ
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ToolTip を描画する対象のコントロールを取得します。
public:
property System::Windows::Forms::Control ^ AssociatedControl { System::Windows::Forms::Control ^ get(); };
public System.Windows.Forms.Control AssociatedControl { get; }
public System.Windows.Forms.Control? AssociatedControl { get; }
member this.AssociatedControl : System.Windows.Forms.Control
Public ReadOnly Property AssociatedControl As Control
Control に関連付けられている ToolTip。ツールヒントがコントロールに関連付けられていない場合は null
。
次のコード例では、このメンバーの使用方法を示します。 この例では、イベント ハンドラーがイベントの ToolTip.Popup 発生を報告します。 このレポートは、イベントが発生したタイミングを確認するのに役立ち、デバッグに役立ちます。 複数のイベントまたは頻繁に発生するイベントを報告するには、 を Console.WriteLine に置き換えるかMessageBox.Show、複数行TextBoxにメッセージを追加することを検討してください。
コード例を実行するには、 という名前ToolTip1
の型ToolTipのインスタンスを含むプロジェクトに貼り付けます。 次に、イベント ハンドラーがイベントに関連付けられていることを確認します ToolTip.Popup 。
private void ToolTip1_Popup(Object sender, PopupEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "AssociatedWindow", e.AssociatedWindow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "AssociatedControl", e.AssociatedControl );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "IsBalloon", e.IsBalloon );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolTipSize", e.ToolTipSize );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Cancel", e.Cancel );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Popup Event" );
}
Private Sub ToolTip1_Popup(sender as Object, e as PopupEventArgs) _
Handles ToolTip1.Popup
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "AssociatedWindow", e.AssociatedWindow)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "AssociatedControl", e.AssociatedControl)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "IsBalloon", e.IsBalloon)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ToolTipSize", e.ToolTipSize)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Cancel", e.Cancel)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"Popup Event")
End Sub
メソッドを ToolTip 使用して ToolTip.SetToolTip を複数のコントロールに関連付けることができるため、 プロパティを AssociatedControl 使用して、イベントが関連付けられているコントロールを Draw 特定できます。 これは、関連付けられたコントロールに基づいてさまざまなツールヒントのカスタマイズを実行する場合に役立ちます。
製品 | バージョン |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。