共用方式為


CoreWebView2CompositionController.SendMouseInput Method

Definition

Sends mouse input to the WebView.

public void SendMouseInput (Microsoft.Web.WebView2.Core.CoreWebView2MouseEventKind eventKind, Microsoft.Web.WebView2.Core.CoreWebView2MouseEventVirtualKeys virtualKeys, uint mouseData, System.Drawing.Point point);
member this.SendMouseInput : Microsoft.Web.WebView2.Core.CoreWebView2MouseEventKind * Microsoft.Web.WebView2.Core.CoreWebView2MouseEventVirtualKeys * uint32 * System.Drawing.Point -> unit
Public Sub SendMouseInput (eventKind As CoreWebView2MouseEventKind, virtualKeys As CoreWebView2MouseEventVirtualKeys, mouseData As UInteger, point As Point)

Parameters

eventKind
CoreWebView2MouseEventKind

The mouse event kind.

virtualKeys
CoreWebView2MouseEventVirtualKeys

The virtual keys associated with the eventKind.

mouseData
UInt32

The amount of wheel movement.

point
Point

The absolute position of the mouse, or the amount of motion since the last mouse event was generated, depending on the eventKind.

Remarks

If eventKind is HorizontalWheel or Wheel, then mouseData specifies the amount of wheel movement. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user. One wheel click is defined as WHEEL_DELTA, which is 120. If eventKind is XButtonDoubleClick, XButtonDown, or XButtonUp, then mouseData specifies which X buttons were pressed or released. This value should be 1 if the first X button is pressed/released and 2 if the second X button is pressed/released. If eventKind is Leave, then virtualKeys, mouseData, and point should all be zero. If eventKind is any other value, then mouseData should be zero. point is expected to be in the client coordinate space of the WebView. To track mouse events that start in the WebView and can potentially move outside of the WebView and host application, calling SetCapture and ReleaseCapture is recommended. To dismiss hover popups, it is also recommended to send Leave messages.

Applies to