1

我有自己的表单,修改后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);
    }
}

在这个表格上,我有一个面板:

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;

在这个面板上,我有浏览器控制:

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. 为什么ESCAPE键不起作用?

2. 如何在 CefWebBrowser 弹出菜单中禁用并禁用跟随链接?

4

1 回答 1

1

您可以拦截来自本机窗口的任何键输入,并将所需的键通过CefBrowserHost.SendKeyEvent.

于 2013-05-20T21:16:44.540 回答