public void MouseEvent(int x, int y, bool updown, MouseButton button) { //_lifespanHandler.MainBrowserHost.SendFocusEvent(true); //_lifespanHandler.MainBrowser.GetHost().SendFocusEvent(true); CefMouseEvent mouseEvent = new CefMouseEvent() { X = x, Y = y, }; CefEventFlags modifiers = new CefEventFlags(); CefMouseButtonType mouse = CefMouseButtonType.Left; if (button == MouseButton.Left) { modifiers |= CefEventFlags.LeftMouseButton; mouse = CefMouseButtonType.Left; } if (button == MouseButton.Right) { mouse = CefMouseButtonType.Right; modifiers |= CefEventFlags.RightMouseButton; } if (button == MouseButton.Middle) { mouse = CefMouseButtonType.Middle; modifiers |= CefEventFlags.MiddleMouseButton; } mouseEvent.Modifiers = modifiers; // log.Info("CLICK:" + x + "," + y); _lifespanHandler.MainBrowser.GetHost().SendMouseClickEvent(mouseEvent, mouse, updown, 1); }
public void SendMouseUpDown(int x, int y, CefMouseButtonType button, bool isMouseUp) { if (this.Browser != null) { var host = this.Browser.GetHost(); if (!isMouseUp) { if (IsContinuousClick(x, y, button)) { clickCount++; } else { clickCount = 1; } } var mouseEvent = new CefMouseEvent { X = x, Y = y }; host.SendMouseClickEvent(mouseEvent, button, isMouseUp, clickCount); lastClickPosX = x; lastClickPosY = y; lastClickButton = button; lastClickTime = DateTime.Now; } }
public void SendMouseButtonEvent(int x, int y, CefMouseButtonType buttonType, bool mouseUp) { this._browserHost.SendMouseClickEvent(new CefMouseEvent { X = x, Y = y }, buttonType, mouseUp, 1); }
public void SendMouseClick(int x, int y, CefMouseButtonType button, bool mouseUp) { if (this.sHost == null) { return; } this.sHost.SendMouseClickEvent(new CefMouseEvent(x, y, 0), button, mouseUp, 1); }
/// <summary> /// Sends a mouse up event to the browser. /// </summary> /// <param name="x">The x-coordinate of the mouse relative to the left edge of the view.</param> /// <param name="y">The y-coordinate of the mouse relative to the top edge of the view.</param> /// <param name="button">One of the <see cref="CefMouseButtonType"/> values.</param> /// <param name="clicks">A click count.</param> /// <param name="modifiers">A bitwise combination of the <see cref="CefEventFlags"/> values.</param> public void SendMouseUpEvent(int x, int y, CefMouseButtonType button, int clicks, CefEventFlags modifiers) { CefBrowserHost browserHost = this.BrowserObject?.Host; if (browserHost == null) { return; } InitMouseEvent(x, y, modifiers); browserHost.SendFocusEvent(true); browserHost.SendMouseClickEvent(_mouseEventProxy, button, true, clicks); }
private bool IsContinuousClick(int x, int y, CefMouseButtonType button) { // ダブルクリックとして認識するクリックの間隔よりも大きかった場合は継続的なクリックとみなさない var delta = (DateTime.Now - lastClickTime).TotalMilliseconds; if (delta > System.Windows.Forms.SystemInformation.DoubleClickTime) { return(false); } // クリック位置が違う、もしくはボタンが違う場合にも継続的なクリックとはみなさない if (lastClickPosX != x || lastClickPosY != y || lastClickButton != button) { return(false); } return(true); }
public void SendMouseMove(int x, int y, CefMouseButtonType button) { if (this.Browser != null) { var host = this.Browser.GetHost(); var mouseEvent = new CefMouseEvent { X = x, Y = y }; if (button == CefMouseButtonType.Left) { mouseEvent.Modifiers = CefEventFlags.LeftMouseButton; } else if (button == CefMouseButtonType.Middle) { mouseEvent.Modifiers = CefEventFlags.MiddleMouseButton; } else if (button == CefMouseButtonType.Right) { mouseEvent.Modifiers = CefEventFlags.RightMouseButton; } host.SendMouseMoveEvent(mouseEvent, false); } }
private bool IsContinuousClick(int x, int y, CefMouseButtonType button) { // ダブルクリックとして認識するクリックの間隔よりも大きかった場合は継続的なクリックとみなさない var delta = (DateTime.Now - lastClickTime).TotalMilliseconds; if (delta > System.Windows.Forms.SystemInformation.DoubleClickTime) { return false; } // クリック位置が違う、もしくはボタンが違う場合にも継続的なクリックとはみなさない if (lastClickPosX != x || lastClickPosY != y || lastClickButton != button) { return false; } return true; }
/// <summary> /// Send a mouse click event to the browser. The |x| and |y| coordinates are /// relative to the upper-left corner of the view. /// </summary> public void SendMouseClickEvent(CefMouseEvent @event, CefMouseButtonType type, bool mouseUp, int clickCount) { var n_event = @event.ToNative(); cef_browser_host_t.send_mouse_click_event(_self, &n_event, type, mouseUp ? 1 : 0, clickCount); }
/// <summary> /// Send a mouse click event to the browser. /// The |x| and |y| coordinates are relative to the upper-left corner of the view. /// </summary> public void SendMouseClickEvent(int x, int y, CefMouseButtonType type, bool mouseUp, int clickCount) { cef_browser_t.invoke_send_mouse_click_event(this.ptr, x, y, (cef_mouse_button_type_t)type, mouseUp ? 1 : 0, clickCount); }
public static void send_mouse_click_event(cef_browser_host_t* self, cef_mouse_event_t* @event, CefMouseButtonType type, int mouseUp, int clickCount) { send_mouse_click_event_delegate d; var p = self->_send_mouse_click_event; if (p == _p1d) { d = _d1d; } else { d = (send_mouse_click_event_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(send_mouse_click_event_delegate)); if (_p1d == IntPtr.Zero) { _d1d = d; _p1d = p; } } d(self, @event, type, mouseUp, clickCount); }
public static void send_mouse_click_event(cef_browser_host_t *self, cef_mouse_event_t * @event, CefMouseButtonType type, int mouseUp, int clickCount) { send_mouse_click_event_delegate d; var p = self->_send_mouse_click_event; if (p == _p1c) { d = _d1c; } else { d = (send_mouse_click_event_delegate)Marshal.GetDelegateForFunctionPointer(p, typeof(send_mouse_click_event_delegate)); if (_p1c == IntPtr.Zero) { _d1c = d; _p1c = p; } } d(self, @event, type, mouseUp, clickCount); }
/// <summary> /// Send a mouse click event to the browser. The |x| and |y| coordinates are /// relative to the upper-left corner of the view. /// </summary> public void SendMouseClickEvent(cef_mouse_event_t * @event, CefMouseButtonType type, int mouseUp, int clickCount) { throw new NotImplementedException(); // TODO: CefBrowserHost.SendMouseClickEvent }
/// <summary> /// Send a mouse click event to the browser. The |x| and |y| coordinates are /// relative to the upper-left corner of the view. /// </summary> public void SendMouseClickEvent(CefMouseEvent @event, CefMouseButtonType type, bool mouseUp, int clickCount) { BrowserHost?.SendMouseClickEvent(@event, type, mouseUp, clickCount); }
public unsafe extern void SendMouseClickEvent([Immutable] cef_mouse_event_t * @event, CefMouseButtonType type, int mouseUp, int clickCount);
private void MouseClickEvent(CefMouseEvent mouseEvent, int clickCount, CefMouseButtonType button, bool mouseUp) { browserHost.SendMouseClickEvent(mouseEvent, button, mouseUp, clickCount); }
/// <summary> /// Send a mouse click event to the browser. The |x| and |y| coordinates are /// relative to the upper-left corner of the view. /// </summary> public unsafe virtual void SendMouseClickEvent(CefMouseEvent @event, CefMouseButtonType type, bool mouseUp, int clickCount) { NativeInstance->SendMouseClickEvent((cef_mouse_event_t *)&@event, type, mouseUp ? 1 : 0, clickCount); GC.KeepAlive(this); }