简体   繁体   English

表单的CefWebBrowser和ProcessCmdKey

[英]CefWebBrowser and ProcessCmdKey of form

I have own form with modified ProcessCmdKey : 我有修改过的ProcessCmdKey表单:

private class MyForm : Form
{
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (keyData == (Keys.Escape))
        {
            this.BeginInvoke((MethodInvoker)delegate { this.Close(); }); 
            return true;     
        }
        return base.ProcessCmdKey(ref msg, keyData);
    }
}

On this form I have a panel: 在此表单上,我有一个小组:

this._panel.BorderStyle = System.Windows.Forms.BorderStyle.None;
this._form.Controls.Add(this._panel);
this._panel.Parent = this._form;
this._panel.Size = this._form.Size;

On this panel I've browser control: 在此面板上,我拥有浏览器控件:

this._Chrome = new Xilium.CefGlue.WindowsForms.CefWebBrowser();
this._Chrome.StartUrl = "google.ru";
this._Chrome.Parent = this._panel;
this._Chrome.Dock = DockStyle.Fill;
this._Chrome.BringToFront();

1. Why ESCAPE key doesn't work? 1.为什么ESCAPE键不起作用?

2. How to disable in CefWebBrowser popup menu and disable follow link? 2.如何在CefWebBrowser弹出菜单中禁用和禁用关注链接?

您可以拦截来自本机窗口的任何键输入,然后通过CefBrowserHost.SendKeyEvent将所需的键传递给浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM