public void ShowOrHideWindow(DockContent dockcontent) { if (DockPanel == null) { dockcontent.Show(WindowUtility.DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Float); } else { if (!dockcontent.Visible || (DockState.DockTopAutoHide <= dockcontent.DockState && dockcontent.DockState <= DockState.DockRightAutoHide)) { if (dockcontent.Pane != null) { dockcontent.Show(DockPanel); dockcontent.Pane.ActiveContent = dockcontent; } else { dockcontent.Show(DockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Float); } } else { if (DockPanel.ActivePane == dockcontent.Pane || dockcontent.DockState == DockState.Float) { } else { dockcontent.Focus(); } } } }
public DockContent ShowContent(string sTitle) { DockContent frm_dock = FindDocument(sTitle); if (frm_dock == null) { string sName = GetToolName(sTitle); if (sName == "") { return(null); } string[] sArrTitle = sName.Split('.'); string sAssemblyName = sArrTitle[0]; try { Assembly assembly = Assembly.Load(sAssemblyName); Type typForm = assembly.GetType(sName); Object mdiChild = typForm.InvokeMember ( null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null ); if (mdiChild != null) { frm_dock = mdiChild as DockContent; frm_dock.Owner = this; frm_dock.WindowState = FormWindowState.Maximized; } } catch (FileNotFoundException) { MessageBox.Show("Unable to load assembly...", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(null); } catch (NullReferenceException) { MessageBox.Show("The file or directory cannot be found.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(null); } } frm_dock.Show(this.dockPanel1); frm_dock.Focus(); frm_dock.BringToFront(); return(frm_dock); }
private void ShowHomePage(string strCaption) { DockContent frm = FindDocument(strCaption); if (frm == null) { Frm_TargetUrlView frm_TargetUrlView = new Frm_TargetUrlView("", m_strDBConStringPath + "home.db", strCaption, this); frm_TargetUrlView.MdiParent = this; frm_TargetUrlView.WindowState = FormWindowState.Maximized; frm_TargetUrlView.Show(this.dockPanel1); frm_TargetUrlView.Focus(); frm_TargetUrlView.BringToFront(); return; } frm.Show(this.dockPanel1); frm.Focus(); frm.BringToFront(); return; }
public DockContent ShowContent(string caption /*, Type formType*/) { DockContent frm = FindDocument(caption); if (frm == null) { string strTemp = GetClassByName(caption); if (strTemp == "") { return(null); } string[] strSplit = strTemp.Split('.'); string strAssemblyName = strSplit[0]; Assembly assembly = Assembly.Load(strAssemblyName); Type typForm = assembly.GetType(strTemp); //关于InvokeMember用法,不明白的可以查看:http://msdn.microsoft.com/zh-cn/library/de3dhzwy(VS.80).aspx Object mdiChild = typForm.InvokeMember( null, BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null); if (mdiChild != null) { frm = mdiChild as DockContent; frm.MdiParent = this; frm.WindowState = FormWindowState.Maximized; } } frm.Show(this.dockPanel); frm.Focus(); frm.BringToFront(); return(frm); }
public DockContent ShowContent(string caption /*, Type formType*/) { DockContent frm = FindDocument(caption); if (frm == null) { Frm_TargetUrlView frm_TargetUrlView = new Frm_TargetUrlView((string)this.treeViewTask.SelectedNode.Parent.Text , m_strDBConStringPath + m_strTreeNodeName , (string)this.treeViewTask.SelectedNode.Text, this); frm_TargetUrlView.MdiParent = this; frm_TargetUrlView.WindowState = FormWindowState.Maximized; frm_TargetUrlView.Show(this.dockPanel1); frm_TargetUrlView.Focus(); frm_TargetUrlView.BringToFront(); return(frm_TargetUrlView); } frm.Show(this.dockPanel1); frm.Focus(); frm.BringToFront(); return(frm); }
void content_FormClosed(object sender, FormClosedEventArgs e) { try { DockContent dock = (DockContent)sender; dock.FormClosed -= content_FormClosed; dock.Focus(); List <DockContent> typeList = DockContents[dock.GetType()]; typeList.Remove(dock); var handler = DockContentRemoved; if (handler != null) { handler(this, new DockContentEventArgs(dock)); } if (dock.Pane.Contents.Count == 2) { if (viewFilesToolStripMenuItem.Checked && (dock.Pane == DockFiles.Pane)) { DockFiles.PanelPane.Layout -= PanelPane_Layout; DockFiles.Show(); DockFiles.PanelPane.Layout += PanelPane_Layout; } else if (viewEditorsToolStripMenuItem.Checked && (dock.Pane == DockEditors.Pane)) { DockEditors.PanelPane.Layout -= PanelPane_Layout; DockEditors.Show(); DockEditors.PanelPane.Layout += PanelPane_Layout; } } } catch (Exception ex) { Utility.ReportException(ex); } }
public static void ShowOrHideWindow(DockPanel dockPanel, DockContent dockcontent, Keys modifierKeys) { if (!dockcontent.Visible || (DockState.DockTopAutoHide <= dockcontent.DockState && dockcontent.DockState <= DockState.DockRightAutoHide)) { if (dockcontent.Pane != null) { dockcontent.Show(dockPanel); dockcontent.Pane.ActiveContent = dockcontent; } else { dockcontent.Show(dockPanel, WeifenLuo.WinFormsUI.Docking.DockState.Float); } } else { if (dockPanel.ActivePane == dockcontent.Pane || dockcontent.DockState == DockState.Float) { dockcontent.Hide(); } else { dockcontent.Focus(); } } if (dockcontent.DockState == DockState.Unknown) { dockcontent.Show(dockPanel, DockState.Document); dockcontent.Pane.ActiveContent = dockcontent; } if ((modifierKeys & Keys.Shift) == Keys.Shift) { dockcontent.DockPanel = null; dockcontent.Show(dockPanel, DockState.Float); dockcontent.Pane.ActiveContent = dockcontent; } }
public void ShowContent(DockContent frm) { frm.Show(this.dockPanel1); frm.Focus(); frm.BringToFront(); }