标签:www rom map arp controls return 实例化 views modifier
winform嵌入chrome浏览器
private void Form1_Load(object sender, EventArgs e)
{
ChromiumWebBrowser b = new ChromiumWebBrowser("http://localhost:57531/views/Map/scene.html");
this.Controls.Add(b);
b.Dock = DockStyle.Fill;
b.KeyboardHandler = new CEFKeyBoardHander();
}
public class CEFKeyBoardHander : IKeyboardHandler
{//https://bbs.csdn.net/topics/392375553
public bool OnKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey)
{
if (type == KeyType.KeyUp && Enum.IsDefined(typeof(Keys), windowsKeyCode))
{
var key = (Keys)windowsKeyCode;
switch (key)
{
case Keys.F12:
browser.ShowDevTools();
break;
case Keys.F5:
if (modifiers == CefEventFlags.ControlDown)
{
//MessageBox.Show("ctrl+f5");
browser.Reload(true); //强制忽略缓存
}
else
{
//MessageBox.Show("f5");
browser.Reload();
}
break;
}
}
return false;
}
public bool OnPreKeyEvent(IWebBrowser browserControl, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
{
return false;
}
}
From: https://www.cnblogs.com/xuejianxiyang/p/9981398.html
CefSharp F12打开DevTools查看console
标签:www rom map arp controls return 实例化 views modifier
原文地址:https://www.cnblogs.com/xuejianxiyang/p/9981398.html