简体   繁体   English

Visual Studio - CefSharp 和 KeyEventArgs 不响应我的输入

[英]Visual Studio - CefSharp and KeyEventArgs doesn't respond to my inputs

Here is the code:这是代码:

        browserControl.KeyDown += new System.Windows.Forms.KeyEventHandler(BrowserControl_KeyDown);

        private void BrowserControl_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.E)
                MessageBox.Show("E");
        }

I assumed that when i entered the browserControl (a CefSharp ChromiumWebBrowser), it will simply give me a message box with the message "E".我假设当我输入 browserControl(一个 CefSharp ChromiumWebBrowser)时,它只会给我一个带有消息“E”的消息框。 Obviously, But no.显然,但是没有。 absolutely nothing i am trying to make something there but i don't think i would download a browser where you get stuck in fullscreen mode because none of the shortcut keys work.绝对没有我想在那里做点什么,但我不认为我会下载一个浏览器,因为没有一个快捷键可以工作。

Here is another solution i searched up and appearently should work, and it does if i click a button outside the browser, but not when i need it:这是我搜索到的另一个解决方案,看起来应该可以工作,如果我点击浏览器外部的按钮,它会起作用,但在我需要的时候不会:

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.E)
            {
                MessageBox.Show("E.. A... GAMES");
            }
            return base.ProcessCmdKey(ref msg, keyData);
        }

I mean come on, I am overriding the whole key process.我的意思是来吧,我正在覆盖整个关键过程。 and still gives me absolutely nothing?仍然没有给我任何东西? What?什么?

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

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