html语言中mouse over,HtmlDocument.MouseOver 事件 (System.Windows.Forms) | Microsoft Docs

發生於滑鼠移至文件上方時。Occurs when the mouse is moved over the document.

public:

event System::Windows::Forms::HtmlElementEventHandler ^ MouseOver;

public event System.Windows.Forms.HtmlElementEventHandler MouseOver;

member this.MouseOver : System.Windows.Forms.HtmlElementEventHandler

Public Custom Event MouseOver As HtmlElementEventHandler

事件類型

範例

下列程式碼範例將示範如何使用這個成員。The following code example demonstrates the use of this member. 在此範例中,事件處理常式會報告事件的發生情況 MouseOver 。In the example, an event handler reports on the occurrence of the MouseOver event. 這份報告可協助您瞭解發生事件的時間,並協助您進行調試。This report helps you to learn when the event occurs and can assist you in debugging. To report on multiple events or on events that occur frequently, consider replacing MessageBox.Show with Console.WriteLine or appending the message to a multiline TextBox.

若要執行範例程式碼,請將它貼到包含名為之類型實例的專案中 HtmlDocument HtmlDocument1 。To run the example code, paste it into a project that contains an instance of type HtmlDocument named HtmlDocument1. 然後確定事件處理常式與事件相關聯 MouseOver 。Then ensure that the event handler is associated with the MouseOver event.

private void HtmlDocument1_MouseOver(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(), "MouseOver Event" );

}Private Sub HtmlDocument1_MouseOver(sender as Object, e as HtmlElementEventArgs) _

Handles HtmlDocument1.MouseOver

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(),"MouseOver Event")

End Sub

備註

如需處理事件、 處理和引發事件的詳細資訊。For more information about handling events, Handling and Raising Events.

適用於

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值