PopupEventArgs.AssociatedWindow 屬性

定義

取得此 ToolTip 所繫結的視窗。

public:
 property System::Windows::Forms::IWin32Window ^ AssociatedWindow { System::Windows::Forms::IWin32Window ^ get(); };
public System.Windows.Forms.IWin32Window AssociatedWindow { get; }
public System.Windows.Forms.IWin32Window? AssociatedWindow { get; }
member this.AssociatedWindow : System.Windows.Forms.IWin32Window
Public ReadOnly Property AssociatedWindow As IWin32Window

屬性值

主控 ToolTip 的視窗。

範例

下列程式碼範例示範此成員的使用。 在此範例中,事件處理常式會報告事件發生次數 ToolTip.Popup 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 MessageBox.ShowConsole.WriteLine 為 或將訊息附加至多行 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

備註

當視窗由另一個視窗擁有時,擁有的視窗會最小化,並以擁有者視窗關閉。 擁有的視窗也不會顯示在其擁有者表單後面。 在此情況下,工具提示是由屬性所 AssociatedWindow 代表的原生 Win32 視窗所擁有。

適用於

另請參閱