public bool OnContextMenuCommand(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, CefMenuCommand commandId, CefEventFlags eventFlags) { //当前浏览器对象,通过它获取所在的Form窗体 ChromiumWebBrowser cwb = (ChromiumWebBrowser)browserControl; System.Windows.Forms.Form form = null; System.Windows.Forms.Control parent = cwb.Parent; while (!(parent is System.Windows.Forms.Form)) { parent = cwb.Parent; } form = (System.Windows.Forms.Form)parent; //处理右键事件 int comid = (int)commandId; if (comid == 221) { if (aboutForm == null || aboutForm.IsDisposed) { aboutForm = new AboutForm(); } aboutForm.ShowDialog(); aboutForm.Focus(); } return(false); }
/// <summary> /// “关于”对话框 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void iAbout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (m_abForm == null || m_abForm.IsDisposed == true) { m_abForm = new AboutForm(); } m_abForm.Show(); m_abForm.Focus(); }
private void aboutBtn_Click(object sender, EventArgs e) { if (aboutForm_ == null || aboutForm_.IsDisposed) { aboutForm_ = new AboutForm(); aboutForm_.Show(); } else { aboutForm_.Show(); aboutForm_.Focus(); } }