using Chromium.WebBrowser; using NetDimension.NanUI; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.MicroApplet { public partial class frmAdminPage : Formium { public frmAdminPage(): base("") { InitializeComponent(); try { this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.LifeSpanHandler.OnBeforePopup += LifeSpanHandler_OnBeforePopup; this.KeyboardHandler.OnKeyEvent += KeyboardHandler_OnKeyEvent; } catch { } } int oldKey = 0; private void KeyboardHandler_OnKeyEvent(object sender, Chromium.Event.CfxOnKeyEventEventArgs e) { if (e.Event.WindowsKeyCode == (int)Keys.F12 && oldKey == 17) { oldKey = 0; this.OpenShowDevTools(); } else { oldKey = e.Event.WindowsKeyCode; } } public new BrowserCore Chromium => base.Chromium; delegate void ShowDevToolsDelegate(); void OpenShowDevTools() { try { if (this.InvokeRequired) { ShowDevToolsDelegate setValue = new ShowDevToolsDelegate(OpenShowDevTools); this.Invoke(setValue); } else { //this.ShowDevTools(this.Handle); this.Chromium.ShowDevTools(this.Handle); } } catch { } finally { } } void LifeSpanHandler_OnBeforePopup(object sender, Chromium.Event.CfxOnBeforePopupEventArgs e) { } /// /// 设置为内嵌窗体 /// public void SetEmbeddedWindows() { // this.BorderSize = 0; this.BorderWidth = 0; this.FormBorderStyle = FormBorderStyle.None; this.Dock = System.Windows.Forms.DockStyle.Fill; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.EnableFormShadow = false; this.MaximizeBox = false; this.MinimizeBox = false; this.TopLevel = false; } /// /// 设置为内嵌窗体 /// public void SetEmbeddedWindows(Control _Control) { this.SetEmbeddedWindows(); _Control.Controls.Add(this); this.Show(); } } }