private void NewPageForm_Load(object sender, EventArgs e) { webBrowser = new ChromiumWebBrowser(mUrl); webBrowser.GlobalObject.AddFunction("newpage").Execute += NewPage; webBrowser.GlobalObject.AddFunction("closefrm").Execute += CloseFrm; webBrowser.Dock = DockStyle.Fill; //铺满 this.Controls.Add(webBrowser); //加入窗体 cwh = new ChromWebHelper(webBrowser); CEFHelper.cefevent(webBrowser, this.Handle); }
private void Form1_Load(object sender, EventArgs e) { testWeb = new ChromiumWebBrowser(mUrl); testWeb.GlobalObject.AddFunction("newpage").Execute += NewPage; //定义JS调用C#事件 testWeb.GlobalObject.AddFunction("userLogin").Execute += UserLogin; //定义JS调用C#事件 testWeb.Dock = DockStyle.Fill; //铺满 this.WindowState = FormWindowState.Maximized; this.Controls.Add(testWeb); cwh = new ChromWebHelper(testWeb); //右键菜单设置 CEFHelper.cefevent(testWeb, this.Handle); //F12调试窗口 }