public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int keyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey) { var ctrl = modifiers.HasFlag(CefEventFlags.ControlDown); var shift = modifiers.HasFlag(CefEventFlags.ShiftDown); if (type == KeyType.KeyUp) { if (ctrl && keyCode == (int)Keys.F) { FindRequested?.Invoke(); } if (keyCode == (int)Keys.Home) { HomeNavigationRequested?.Invoke(); } if ((ctrl && keyCode == (int)Keys.Add) || (ctrl && shift && keyCode == (int)Keys.D1)) { ZoomInRequested?.Invoke(); } if (ctrl && (keyCode == (int)Keys.Subtract || keyCode == (int)Keys.OemMinus)) { ZoomOutRequested?.Invoke(); } if (ctrl && (keyCode == (int)Keys.D0 || keyCode == (int)Keys.NumPad0)) { ZoomResetRequested?.Invoke(); } } return(false); }
public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int keyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey) { var ctrl = modifiers.HasFlag(CefEventFlags.ControlDown); var shift = modifiers.HasFlag(CefEventFlags.ShiftDown); if (type == KeyType.KeyUp && ((keyCode == (int)Keys.Add && ctrl) || (keyCode == (int)Keys.D1 && ctrl && shift))) { ZoomInRequested?.Invoke(); } if (type == KeyType.KeyUp && (keyCode == (int)Keys.Subtract || keyCode == (int)Keys.OemMinus) && ctrl) { ZoomOutRequested?.Invoke(); } if (type == KeyType.KeyUp && (keyCode == (int)Keys.D0 || keyCode == (int)Keys.NumPad0) && ctrl) { ZoomResetRequested?.Invoke(); } return(false); }