我有自己的winforms表单,修改后的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;
在此面板上,我cef浏览器控件:
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弹出菜单中禁用并禁用关注链接?
答案 0 :(得分:1)
您可以截取本机窗口中的任何键输入,并通过CefBrowserHost.SendKeyEvent
将所需的键传递给浏览器。