HtmlDocument.MouseLeave 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当鼠标不再悬停于文档上时发生。
public:
event System::Windows::Forms::HtmlElementEventHandler ^ MouseLeave;
public event System.Windows.Forms.HtmlElementEventHandler MouseLeave;
public event System.Windows.Forms.HtmlElementEventHandler? MouseLeave;
member this.MouseLeave : System.Windows.Forms.HtmlElementEventHandler
Public Custom Event MouseLeave As HtmlElementEventHandler
事件类型
示例
下面的代码示例演示了此成员的用法。 在此示例中,事件处理程序报告事件的发生情况 MouseLeave 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑将 MessageBox.ShowConsole.WriteLine 消息替换为 或将消息追加到多行 TextBox。
若要运行示例代码,请将其粘贴到包含名为 HtmlDocument1
的类型的HtmlDocument实例的项目中。 然后,确保事件处理程序与 MouseLeave 事件相关联。
private void HtmlDocument1_MouseLeave(Object sender, HtmlElementEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "MouseButtonsPressed", e.MouseButtonsPressed );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ClientMousePosition", e.ClientMousePosition );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "OffsetMousePosition", e.OffsetMousePosition );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "MousePosition", e.MousePosition );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "BubbleEvent", e.BubbleEvent );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "KeyPressedCode", e.KeyPressedCode );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "AltKeyPressed", e.AltKeyPressed );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CtrlKeyPressed", e.CtrlKeyPressed );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ShiftKeyPressed", e.ShiftKeyPressed );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "EventType", e.EventType );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "FromElement", e.FromElement );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToElement", e.ToElement );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "MouseLeave Event" );
}
Private Sub HtmlDocument1_MouseLeave(sender as Object, e as HtmlElementEventArgs) _
Handles HtmlDocument1.MouseLeave
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "MouseButtonsPressed", e.MouseButtonsPressed)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ClientMousePosition", e.ClientMousePosition)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "OffsetMousePosition", e.OffsetMousePosition)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "MousePosition", e.MousePosition)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "BubbleEvent", e.BubbleEvent)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "KeyPressedCode", e.KeyPressedCode)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "AltKeyPressed", e.AltKeyPressed)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "CtrlKeyPressed", e.CtrlKeyPressed)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ShiftKeyPressed", e.ShiftKeyPressed)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "EventType", e.EventType)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ReturnValue", e.ReturnValue)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "FromElement", e.FromElement)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ToElement", e.ToElement)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"MouseLeave Event")
End Sub
注解
有关处理事件的详细信息,请参阅 处理和引发事件。