예제 #1
0
        private void mDockPanel_ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (mDockPanel.ActiveDocument == null)
            {
                mManager.ActiveDocument = null;
            }
            else
            {
                mCurrentDocumentMenuStrip = mDockPanel.ActiveDocument.DockHandler.Form.MainMenuStrip;
                if (mCurrentDocumentMenuStrip != null)
                {
                    ToolStripManager.Merge(mCurrentDocumentMenuStrip, this.MainMenuStrip);
                }
                else
                {
                    ToolStripManager.RevertMerge(this.MainMenuStrip);
                }

                if (mDockPanel.ActiveDocument is DocumentView)
                {
                    DocumentView view = mDockPanel.ActiveDocument as DocumentView;
                    mManager.ActiveDocument = view.Document;
                }
                else
                {
                    mManager.ActiveDocument = null;
                }
            }

            tsiFileSave.Enabled   = (mManager.ActiveDocument != null) && !mManager.ActiveDocument.ReadOnly;
            tsiFileSaveAs.Enabled = (mManager.ActiveDocument != null);
        }
예제 #2
0
        private void MainForm_MdiChildActivate(object sender, EventArgs e)
        {
//            return;
            if (menu_edit.DropDownItems.Count == 0)
            {
                menu_edit.Visible = false;
            }
            ToolStripManager.RevertMerge(toolStrip);

            if (this.ActiveMdiChild == null)
            {
                return;
            }
            if ((ActiveMdiChild as IMergeToolStrip).MergeToolStrip == null)
            {
                return;
            }

            ToolStripManager.Merge((ActiveMdiChild as IMergeToolStrip).MergeToolStrip, toolStrip);

            if (toolStrip.Items.Count > 0)
            {
                toolStrip.Visible = true;
            }
            else
            {
                toolStrip.Visible = false;
            }
        }
예제 #3
0
        protected override void OnMdiChildActivate(EventArgs e)
        {
            DocumentForm olddocument = m_activeDocument;

            base.OnMdiChildActivate(e);
            m_activeDocument = this.ActiveMdiChild as DocumentForm;
            foreach (Control ctrl in Controls)
            {
                if (ctrl is ToolStripPanel)
                {
                    ((ToolStripPanel)ctrl).SuspendLayout();
                }
            }
            if (m_activeDocument != null)
            {
                ToolStripManager.RevertMerge(m_menuItems.GetStrip("edit"));
                ToolStripManager.RevertMerge(m_menuItems.GetStrip("draw"));
                ToolStripManager.RevertMerge(m_menuItems.GetStrip("layer"));
                ToolStripManager.RevertMerge(m_menuItems.GetStrip("status"));
                ToolStripManager.RevertMerge(m_menuItems.GetStrip("modify"));
                ToolStripManager.Merge(m_activeDocument.GetToolStrip("draw"), m_menuItems.GetStrip("draw"));
                ToolStripManager.Merge(m_activeDocument.GetToolStrip("edit"), m_menuItems.GetStrip("edit"));
                ToolStripManager.Merge(m_activeDocument.GetToolStrip("layer"), m_menuItems.GetStrip("layer"));
                ToolStripManager.Merge(m_activeDocument.GetToolStrip("status"), m_menuItems.GetStrip("status"));
                ToolStripManager.Merge(m_activeDocument.GetToolStrip("modify"), m_menuItems.GetStrip("modify"));
            }
            foreach (Control ctrl in Controls)
            {
                if (ctrl is ToolStripPanel)
                {
                    ((ToolStripPanel)ctrl).ResumeLayout();
                }
            }
        }
예제 #4
0
        public void ExtendMenu(ToolStrip menu)
        {
            //Catch Options Menu (6)
            ToolStripMenuItem mnuCatchOptions = new ToolStripMenuItem();

            mnuCatchOptions.MergeIndex  = 6;
            mnuCatchOptions.MergeAction = MergeAction.MatchOnly;

            // sep
            ToolStripSeparator mnuSep = new ToolStripSeparator();

            mnuSep.MergeIndex  = 2;
            mnuSep.MergeAction = MergeAction.Insert;

            //Update
            mnuCheckForUpdates.Image  = Properties.Resources.software_update;
            mnuCheckForUpdates.Click += new EventHandler(mnuCheckForUpdatesOnClick);

            mnuCheckForUpdates.MergeIndex  = 3;
            mnuCheckForUpdates.MergeAction = MergeAction.Insert;

            mnuCatchOptions.DropDownItems.AddRange(new ToolStripItem[] { mnuSep, mnuCheckForUpdates });

            MenuStrip ThisMenu = new MenuStrip();

            ThisMenu.Items.AddRange(new ToolStripItem[] { mnuCatchOptions });
            ThisMenu.AllowMerge = true;

            ToolStripManager.Merge(ThisMenu, menu);

            RefreshUICulture();
        }
예제 #5
0
        private void frmMDIMain_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolStripMDIMain);
                IMergeToolStrip mdiChildMergeToolStrip = ActiveMdiChild as IMergeToolStrip;
                if (mdiChildMergeToolStrip != null)
                {
                    ToolStripManager.Merge(mdiChildMergeToolStrip.ChildToolStrip, toolStripMDIMain);
                }

                ICallToolStrip mdiChildCallToolStrip = ActiveMdiChild as ICallToolStrip;
                if (mdiChildCallToolStrip != null)
                {
                    mdiChildCallToolStrip.PropertyChanged -= new PropertyChangedEventHandler(mdiChildCallToolStrip_PropertyChanged);
                    mdiChildCallToolStrip.PropertyChanged += new PropertyChangedEventHandler(mdiChildCallToolStrip_PropertyChanged);

                    mdiChildCallToolStrip_PropertyChanged(mdiChildCallToolStrip, new PropertyChangedEventArgs("IsDirty"));
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }
예제 #6
0
        private void MasterMdi_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolstripMain);
                IToolstripMerge mergeToolstrip = ActiveMdiChild as IToolstripMerge;
                if (mergeToolstrip != null)
                {
                    ToolStripManager.Merge(mergeToolstrip.toolstripChild, toolstripMain);
                }

                IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
                if (toolstripChild != null)
                {
                    toolstripChild.PropertyChanged -= new PropertyChangedEventHandler(toolstripChild_PropertyChanged);
                    toolstripChild.PropertyChanged += new PropertyChangedEventHandler(toolstripChild_PropertyChanged);

                    toolstripChild_PropertyChanged(toolstripChild, new PropertyChangedEventArgs("IsDirty"));
                }

                if (ActiveMdiChild != null)
                {
                    ActiveMdiChild.WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
예제 #7
0
        /// <summary>
        /// At runtime this merges ToolStrip with InheritedToolStrip. At design-time, only a clone of ToolStrip is merged (to prefect designer serialization problems)
        /// </summary>
        private void MergeWithInheritedToolStrip()
        {
            ToolStrip sourceMenuStrip;

            if (!IsDesignMode())
            {
                sourceMenuStrip = ToolStrip;
            }
            else
            {
                List <ToolStripItem> lastMergedItems = new List <ToolStripItem>();
                foreach (ToolStripItem item in InheritedToolStrip.Items)
                {
                    if (item.Tag is string && (string)item.Tag == ClonedTag)
                    {
                        lastMergedItems.Add(item);
                    }
                }
                foreach (ToolStripItem item in lastMergedItems)
                {
                    InheritedToolStrip.Items.Remove(item);
                }
                sourceMenuStrip = BasicClone(ToolStrip);
            }

            // .NET already provided the functionality to merge tool strips, so we just use that!
            ToolStripManager.Merge(sourceMenuStrip, InheritedToolStrip);
        }
예제 #8
0
        public void ExtendMenu(ToolStrip menu)
        {
            //Catch the Help menu.
            ToolStripMenuItem mnuCatchParent = new ToolStripMenuItem();

            mnuCatchParent.MergeIndex  = 7;
            mnuCatchParent.MergeAction = MergeAction.MatchOnly;

            mnuCheckForUpdates.Image  = Properties.Resources.software_update;
            mnuCheckForUpdates.Click += new EventHandler(mnuCheckForUpdatesOnClick);

            mnuCheckForUpdates.MergeIndex  = 1;
            mnuCheckForUpdates.MergeAction = MergeAction.Insert;

            mnuCatchParent.DropDownItems.AddRange(new ToolStripItem[] { mnuCheckForUpdates });

            MenuStrip ThisMenu = new MenuStrip();

            ThisMenu.Items.AddRange(new ToolStripItem[] { mnuCatchParent });
            ThisMenu.AllowMerge = true;

            ToolStripManager.Merge(ThisMenu, menu);

            RefreshUICulture();
        }
        public void MethodMergeANE1()
        {
            ToolStrip ts = new ToolStrip();

            ts.Name = "moose";
            ToolStripManager.Merge(null, "moose");
        }
예제 #10
0
파일: MainForm.cs 프로젝트: runmbrun/pbem
        /// <summary>
        /// Will Add menu items from a game module to the main form's tool strip or menu strip.
        /// </summary>
        /// <param name="menuItem">The menu items to merge.</param>
        private void AddMenuItems(IMenuItem menuItem)
        {
            if (menuItem != null)
            {
                ToolStrip toolStrip = menuItem.GetToolStrip();
                foreach (ToolStripItem ts in toolStrip.Items)
                {
                    ts.Tag = "Game";
                }

                ToolStripManager.Merge(toolStrip, this.toolStrip1);
                toolStrip = null;

                MenuStrip menuStrip = menuItem.GetMenuStrip();

                if (menuStrip.Items.Count > 0)
                {
                    menuStrip.Items[0].Tag = "Game";
                    this.menuStrip1.Items.Insert(0, menuStrip.Items[0]);
                }

                menuStrip = null;

                menuItem = null;
            }
        }
예제 #11
0
 private void PPS_SCH_002_Activated(object sender, EventArgs e)
 {
     ((MainForm)this.MdiParent).MyUpdateEvent    += new System.EventHandler(this.MyUpdateShow); //수정이벤트
     ((MainForm)this.MdiParent).RefreshFormEvent += new EventHandler(this.RefreshFormShow);     //새로고침
     ToolStripManager.Merge(toolStrip1, ((MainForm)this.MdiParent).toolStrip1);                 //저장버튼 추가
     //toolStrip1.Visible = false;
 }
예제 #12
0
        public Form_Main(FileInfo _fileInfo, object _object)
            : base(_fileInfo, _object)
        {
            this.InitializeComponent();


            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                #region "Menus & Toolbars"
                this.menuStrip2.Visible = false;
                this.toolStrip2.Visible = false;
                //this.statusStrip2.Visible = false;


                if (!ToolStripManager.Merge(this.menuStrip2, base.MenuStrip1))
                {
                    throw new Exception();
                }

                if (!ToolStripManager.Merge(this.toolStrip2, base.ToolStrip1))
                {
                    throw new Exception();
                }

                //if (!this.engineEditor.MergeMenuStripWith(base.MenuStrip1))
                //{
                //    throw new Exception();
                //}
                //if (!this.engineEditor.MergeToolStripWith(base.ToolStrip1))
                //{
                //    throw new Exception();
                //}
                #endregion "Menus & Toolbars"
            }
        }
예제 #13
0
 /// <summary>
 /// Merges the plugin's menu strip into the external menu strip
 /// </summary>
 /// <param name="menuStrip">External menu strip</param>
 virtual public void Merge(MenuStrip menuStrip)
 {
     if (Menu_Strip != null && menuStrip != null)
     {
         ToolStripManager.Merge(Menu_Strip, menuStrip);
     }
 }
예제 #14
0
 /// <summary>
 /// Merges the plugin's tool strip into the external tool strip
 /// </summary>
 /// <param name="toolStrip">External tool strip</param>
 virtual public void Merge(ToolStrip toolStrip)
 {
     if (Tool_Strip != null && toolStrip != null)
     {
         ToolStripManager.Merge(Tool_Strip, toolStrip);
     }
 }
예제 #15
0
 private void Merge(ToolStrip source, ToolStrip target)
 {
     if (source != null)
     {
         ToolStripManager.Merge(source, target);
     }
 }
        public void MethodMergeAE()
        {
            ToolStrip ts = new ToolStrip();

            ts.Name = "mergeae";
            ToolStripManager.Merge(ts, "mergeae");
        }
예제 #17
0
 private void MoldingOrderCreation_Activated(object sender, EventArgs e)
 {
     frm.Insert_Click   += new System.EventHandler(this.ExportToExcel);
     frm.Search_Click   += new System.EventHandler(this.Search);
     frm.btnSave.Enabled = false;
     ToolStripManager.Merge(this.toolStrip1, frm.ToolStrip);
 }
예제 #18
0
        protected internal override ContextMenuStrip GetContextMenu()
        {
            if (ctxMenu != null)
            {
                return(ctxMenu);
            }

            ctxMenu = new ContextMenuStrip();

            var showHex = new ToolStripMenuItem("Show in Hex View");

            showHex.Click += ShowHex;
            ctxMenu.Items.Add(showHex);

            ctxMenu.Items.Add(new ToolStripSeparator());
            ctxMenu.Opening += (sender, e) => {
                var model = sender.GetContextMenuModel <MDTableModel>();
                var view  = (MDTableHeapView)App.Views.LocateViews(model.Parent).Single();
                ToolStripManager.Merge(view.GetContextMenu(), (ContextMenuStrip)sender);
            };
            ctxMenu.Closed += (sender, e) => {
                var model = sender.GetContextMenuModel <MDTableModel>();
                var view  = (MDTableHeapView)App.Views.LocateViews(model.Parent).Single();
                ToolStripManager.RevertMerge((ContextMenuStrip)sender, view.GetContextMenu());
            };

            return(ctxMenu);
        }
예제 #19
0
        private void dockPanel_ActiveContentChanged(object sender, EventArgs e)
        {
            IDockContent activeContent = MainDockPanel.ActiveContent;

            if (activeContent is IEditControl)
            {
                ToolStripManager.RevertMerge(toolStrip1);
            }
            else if (activeContent is IMyGenDocument)
            {
                ToolStripManager.RevertMerge(toolStrip1);
                var mgd = activeContent as IMyGenDocument;
                if (mgd.ToolStrip != null)
                {
                    ToolStripManager.Merge(mgd.ToolStrip, toolStrip1);
                }
            }
            else if (activeContent == null)
            {
                var foundDoc = MainDockPanel.Contents.Cast <DockContent>().Any(c => c is IMyGenDocument && !c.IsHidden);
                if (!foundDoc)
                {
                    ToolStripManager.RevertMerge(toolStrip1);
                }
            }
        }
예제 #20
0
        private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e)
        {
            ToolStripManager.RevertMerge(this.menuStrip1);
            ToolStripManager.RevertMerge(this.toolStrip1);
            if (this.dockPanel1.ActiveContent is IDocument)
            {
                IDocument doc = this.dockPanel1.ActiveDocument as IDocument;
                doc.CanPaste = Clipboard.ContainsText();
                doc.UpdateUI();
                IDocument form = this.dockPanel1.ActiveDocument as IDocument;
                if (form.ToolStrip != null)
                {
                    ToolStripManager.Merge(form.ToolStrip, this.toolStrip1);
                }
                if (form.MenuStrip != null)
                {
                    ToolStripManager.Merge(form.MenuStrip, this.menuStrip1);
                }
            }
            //else if (this.dockPanel1.ActiveContent != null)
            //{

            //    if (this.dockPanel1.ActiveContent is IForm)
            //    {
            //        IForm form = this.dockPanel1.ActiveContent as IForm;
            //        if (form.ToolStrip != null)
            //            ToolStripManager.Merge(form.ToolStrip, this.toolStrip1);
            //        if (form.MenuStrip != null)
            //            ToolStripManager.Merge(form.MenuStrip, this.menuStrip1);

            //    }
            //}
            this.UpdateUI();
        }
 public void MergeToolStrip(ToolStrip toolStrip)
 {
     //if (toolStrip == null) throw new ArgumentNullException(nameof(toolStrip));
     UnmergeToolStrip();
     ToolStripManager.Merge(toolStrip, designer.PrimaryToolStrip);
     ToolStripManager.Merge(designer.SecondaryToolStrip, designer.PrimaryToolStrip);
     _mergedToolstrip = toolStrip;
 }
예제 #22
0
 /// <summary>
 /// MergeContenxtMenuStrip
 /// </summary>
 /// <param name="contextmenuStrip"></param>
 public void MergeContenxtMenuStripForCell(ContextMenuStrip contextmenuStrip)
 {
     if (contextmenuStrip != this.contextMenuStripForCell)
     {
         ToolStripManager.Merge(contextmenuStrip, this.contextMenuStripForCell);
         contextmenuStrip.Visible = false;
     }
 }
예제 #23
0
파일: Practice.cs 프로젝트: aata/szotar
 protected void MergeMenu(ToolStrip menu)
 {
     ToolStripManager.Merge(menu, Owner.Controls);
     if (!mergedMenus.Contains(menu))
     {
         mergedMenus.Add(menu);
     }
 }
        public void MethodMergeNothing()
        {
            // Merge returns false if it can't successfully merge anything
            ToolStrip ts1 = new ToolStrip();
            ToolStrip ts2 = new ToolStrip();

            Assert.AreEqual(false, ToolStripManager.Merge(ts1, ts2), "K1");
        }
        public void MethodMergeToolStripsMatchOnly()
        {
            MenuStrip ms1 = new MenuStrip();
            MenuStrip ms2 = new MenuStrip();

            ToolStripMenuItem tsmi1 = (ToolStripMenuItem)ms1.Items.Add("File");
            ToolStripMenuItem tsmi2 = (ToolStripMenuItem)ms2.Items.Add("File");

            tsmi1.DropDownItems.Add("New 1");
            tsmi1.DropDownItems.Add("Open 1");

            tsmi2.DropDownItems.Add("New 2");
            tsmi2.DropDownItems.Add("Open 2");

            tsmi2.MergeAction = MergeAction.MatchOnly;

            ToolStripManager.Merge(ms2, ms1);

            Assert.AreEqual(4, tsmi1.DropDownItems.Count, "M1");
            Assert.AreEqual(0, tsmi2.DropDownItems.Count, "M2");

            Assert.AreEqual("New 1", tsmi1.DropDownItems[0].Text, "M3-1");
            Assert.AreEqual("Open 1", tsmi1.DropDownItems[1].Text, "M3-2");
            Assert.AreEqual("New 2", tsmi1.DropDownItems[2].Text, "M3-3");
            Assert.AreEqual("Open 2", tsmi1.DropDownItems[3].Text, "M3-4");

            ToolStripManager.RevertMerge(ms1, ms2);

            Assert.AreEqual(2, tsmi1.DropDownItems.Count, "M4");
            Assert.AreEqual(2, tsmi2.DropDownItems.Count, "M5");

            Assert.AreEqual("New 1", tsmi1.DropDownItems[0].Text, "M6-1");
            Assert.AreEqual("Open 1", tsmi1.DropDownItems[1].Text, "M6-2");
            Assert.AreEqual("New 2", tsmi2.DropDownItems[0].Text, "M6-3");
            Assert.AreEqual("Open 2", tsmi2.DropDownItems[1].Text, "M6-4");

            // Do merge twice, as it helps verify things got back
            // to the proper state in the unmerge
            ToolStripManager.Merge(ms2, ms1);

            Assert.AreEqual(4, tsmi1.DropDownItems.Count, "M7");
            Assert.AreEqual(0, tsmi2.DropDownItems.Count, "M8");

            Assert.AreEqual("New 1", tsmi1.DropDownItems[0].Text, "M9-1");
            Assert.AreEqual("Open 1", tsmi1.DropDownItems[1].Text, "M9-2");
            Assert.AreEqual("New 2", tsmi1.DropDownItems[2].Text, "M9-3");
            Assert.AreEqual("Open 2", tsmi1.DropDownItems[3].Text, "M9-4");

            ToolStripManager.RevertMerge(ms1, ms2);

            Assert.AreEqual(2, tsmi1.DropDownItems.Count, "M10");
            Assert.AreEqual(2, tsmi2.DropDownItems.Count, "M11");

            Assert.AreEqual("New 1", tsmi1.DropDownItems[0].Text, "M12-1");
            Assert.AreEqual("Open 1", tsmi1.DropDownItems[1].Text, "M12-2");
            Assert.AreEqual("New 2", tsmi2.DropDownItems[0].Text, "M12-3");
            Assert.AreEqual("Open 2", tsmi2.DropDownItems[1].Text, "M12-4");
        }
예제 #26
0
        public override bool MergeMenuStripWith(MenuStrip _menuStrip)
        {
            bool _bool;

            _bool  = ToolStripManager.Merge(base.MenuStrip1, _menuStrip);
            _bool &= ToolStripManager.Merge(this.menuStrip2, _menuStrip);

            return(_bool);
        }
예제 #27
0
        }//콤보박스 목록선택

        private void PPS_MLD_001_Activated(object sender, EventArgs e)
        {
            ((MainForm)this.MdiParent).InsertFormEvent  += new System.EventHandler(this.InsertFormShow); //입력이벤트 등록
            ((MainForm)this.MdiParent).RefreshFormEvent += new EventHandler(this.RefreshFormShow);       //새로고침이벤트
            ((MainForm)this.MdiParent).MyDeleteEvent    += new EventHandler(this.DeleteFormShow);        //삭제 이벤트
            ToolStripManager.Merge(toolStrip1, ((MainForm)this.MdiParent).toolStrip1);                   //저장버튼 추가
            toolStrip1.Visible = false;
            dgvMainGrid.ClearSelection();
        }
예제 #28
0
 /// <summary>
 /// MergeMenu
 /// MenuStrip[0] 是作为子窗体的主菜单,合并到Mdi窗体中
 /// </summary>
 /// <param name="menuStrip"></param>
 public void MergeMenu(MenuStrip menuStrip)
 {
     m_menuStrips.Add(menuStrip);
     if (menuStrip != this.MenuStrip)
     {
         ToolStripManager.Merge(menuStrip, this.MenuStrip);
         menuStrip.Visible = false;
     }
 }
예제 #29
0
 /// <summary>
 /// MergeToolStrip
 /// </summary>
 /// <param name="toolStrip"></param>
 public void MergeToolStrip(ToolStrip toolStrip)
 {
     m_toolStrips.Add(toolStrip);
     if (toolStrip != this.ToolStrip)
     {
         ToolStripManager.Merge(toolStrip, this.ToolStrip);
         toolStrip.Visible = false;
     }
 }
예제 #30
0
        private void MainFrame_MdiChildActivate(object sender, EventArgs e)
        {
            statusLine.Text = StatusText;
            ToolStripManager.RevertMerge(toolStrip);

            if (ActiveMdiChild is ChildFrame child && child.ChildToolStrip != null)
            {
                ToolStripManager.Merge(child.ChildToolStrip, toolStrip);
            }
        }