ToolTip.Popup 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在最初显示工具提示之前发生。 这是类的默认事件 ToolTip 。
public:
event System::Windows::Forms::PopupEventHandler ^ Popup;
public event System.Windows.Forms.PopupEventHandler Popup;
public event System.Windows.Forms.PopupEventHandler? Popup;
member this.Popup : System.Windows.Forms.PopupEventHandler
Public Custom Event Popup As PopupEventHandler
事件类型
示例
下面的代码示例演示了此成员的使用。 在此示例中,事件处理程序报告事件的发生情况 Popup 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑替换MessageBox.ShowConsole.WriteLine或将消息追加到多行TextBox。
若要运行示例代码,请将其粘贴到包含命名ToolTip类型的ToolTip1实例的项目中。 然后,确保事件处理程序与 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
注解
Popup每当显示工具提示时,都通过显式调用其中一Show种方法或类隐式显示工具提示时ToolTip引发该事件。 可以取消此事件。
在此事件中调用导致重新创建基础窗口句柄的属性,例如 IsBalloon,将导致引发异常。