예제 #1
0
파일: Practice.cs 프로젝트: aata/szotar
 protected void UnmergeMenu(ToolStrip menu)
 {
     ToolStripManager.RevertMerge(Owner.Controls, menu);
     mergedMenus.Remove(menu);
 }
        public void MethodMergeToolStripsReplace()
        {
            // MergeAction = Replace
            ToolStrip ts1 = new ToolStrip();
            ToolStrip ts2 = new ToolStrip();

            ts1.Items.Add("ts1-A");
            ts1.Items.Add("ts1-B");
            ts1.Items.Add("ts1-C");
            ts1.Items.Add("ts1-D");

            ts2.Items.Add("ts1-A");
            ts2.Items.Add("ts1-B");
            ts2.Items.Add("ts1-C");
            ts2.Items.Add("ts1-D");

            ts2.Items[0].MergeAction = MergeAction.Replace;
            ts2.Items[1].MergeAction = MergeAction.Replace;
            ts2.Items[2].MergeAction = MergeAction.Replace;
            ts2.Items[3].MergeAction = MergeAction.Replace;

            // Both the item from ts1 and ts2 must have the same Text for Replace to work,
            // so I need to give these a Name so I can differentiate them later.
            ts1.Items[0].Name = "ts1-A";
            ts1.Items[1].Name = "ts1-B";
            ts1.Items[2].Name = "ts1-C";
            ts1.Items[3].Name = "ts1-D";
            ts2.Items[0].Name = "ts2-A";
            ts2.Items[1].Name = "ts2-B";
            ts2.Items[2].Name = "ts2-C";
            ts2.Items[3].Name = "ts2-D";

            ToolStripManager.Merge(ts2, ts1);

            Assert.AreEqual(4, ts1.Items.Count, "M1");
            Assert.AreEqual(0, ts2.Items.Count, "M2");

            Assert.AreEqual("ts2-A", ts1.Items[0].Name, "M3-5");
            Assert.AreEqual("ts2-B", ts1.Items[1].Name, "M3-6");
            Assert.AreEqual("ts2-C", ts1.Items[2].Name, "M3-7");
            Assert.AreEqual("ts2-D", ts1.Items[3].Name, "M3-8");

            ToolStripManager.RevertMerge(ts1, ts2);

            Assert.AreEqual(4, ts1.Items.Count, "M4");
            Assert.AreEqual(4, ts2.Items.Count, "M5");

            Assert.AreEqual("ts1-A", ts1.Items[0].Name, "M6-1");
            Assert.AreEqual("ts1-B", ts1.Items[1].Name, "M6-2");
            Assert.AreEqual("ts1-C", ts1.Items[2].Name, "M6-3");
            Assert.AreEqual("ts1-D", ts1.Items[3].Name, "M6-4");
            Assert.AreEqual("ts2-A", ts2.Items[0].Name, "M6-5");
            Assert.AreEqual("ts2-B", ts2.Items[1].Name, "M6-6");
            Assert.AreEqual("ts2-C", ts2.Items[2].Name, "M6-7");
            Assert.AreEqual("ts2-D", ts2.Items[3].Name, "M6-8");

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

            Assert.AreEqual(4, ts1.Items.Count, "M7");
            Assert.AreEqual(0, ts2.Items.Count, "M8");

            Assert.AreEqual("ts2-A", ts1.Items[0].Name, "M9-5");
            Assert.AreEqual("ts2-B", ts1.Items[1].Name, "M9-6");
            Assert.AreEqual("ts2-C", ts1.Items[2].Name, "M9-7");
            Assert.AreEqual("ts2-D", ts1.Items[3].Name, "M9-8");

            ToolStripManager.RevertMerge(ts1, ts2);

            Assert.AreEqual(4, ts1.Items.Count, "M10");
            Assert.AreEqual(4, ts2.Items.Count, "M11");

            Assert.AreEqual("ts1-A", ts1.Items[0].Name, "M12-1");
            Assert.AreEqual("ts1-B", ts1.Items[1].Name, "M12-2");
            Assert.AreEqual("ts1-C", ts1.Items[2].Name, "M12-3");
            Assert.AreEqual("ts1-D", ts1.Items[3].Name, "M12-4");
            Assert.AreEqual("ts2-A", ts2.Items[0].Name, "M12-5");
            Assert.AreEqual("ts2-B", ts2.Items[1].Name, "M12-6");
            Assert.AreEqual("ts2-C", ts2.Items[2].Name, "M12-7");
            Assert.AreEqual("ts2-D", ts2.Items[3].Name, "M12-8");
        }
        public void MethodRevertMergeNullArgument2()
        {
            ToolStrip ts = null;

            ToolStripManager.RevertMerge(ts);
        }
예제 #4
0
 private void ProductList_Deactivate(object sender, EventArgs e)
 {
     frm.Search_Click -= new System.EventHandler(this.GetAllList);
     ToolStripManager.RevertMerge(frm.ToolStrip);
 }
예제 #5
0
파일: ViewForm.cs 프로젝트: Kasia4/Books_WF
 private void listViewForm_Leave(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).statusStrip1, this.statusStrip1);
 }
예제 #6
0
 private void ListWindow_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MdiParnet)this.MdiParent).toolStrip2, toolStrip1);
     ToolStripManager.RevertMerge(((MdiParnet)this.MdiParent).statusStrip1, statusStrip1);
 }
 private void BookListForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)MdiParent).mainToolStrip, this.childToolStrip);
     ToolStripManager.RevertMerge(((MainForm)MdiParent).mainStatusStrip, this.childStatusStrip);
 }
예제 #8
0
 private void VehiclesForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).numberOfVehicles, status);
 }
예제 #9
0
 private void ViewForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)MdiParent).statusStrip, statusStrip);
 }
예제 #10
0
 private void BooksForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).statusStrip1, this.statusStrip1);
 }
예제 #11
0
 private void PPS_SCH_002_Deactivate(object sender, EventArgs e)
 {
     ((MainForm)this.MdiParent).MyUpdateEvent    -= new System.EventHandler(this.MyUpdateShow); //수정이벤트
     ((MainForm)this.MdiParent).RefreshFormEvent -= new EventHandler(this.RefreshFormShow);     //새로고침
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).toolStrip1);                       //저장버튼삭제
 }
예제 #12
0
        public void MethodRevertMergeANE()
        {
            ToolStrip ts = new ToolStrip();

            ToolStripManager.RevertMerge(ts, null);
        }
예제 #13
0
 private void PRM_RPT_001_Deactivate(object sender, EventArgs e)
 {
     ((MainForm)this.MdiParent).RefreshFormEvent -= new EventHandler(this.RefreshFormShow); //새로고침
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).toolStrip1);
 }
예제 #14
0
 private void PRM_RPT_004_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).toolStrip1);
 }
예제 #15
0
 private void View_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((Model)MdiParent).modelStatusStrip, viewStatusStrip);
     ToolStripManager.RevertMerge(((Model)MdiParent).modelToolStrip, viewToolStrip);
 }
예제 #16
0
 private void ListForm_Leave(Object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)MdiParent).menuStrip, menuStrip1);
     ToolStripManager.RevertMerge(((MainForm)MdiParent).statusStrip, statusStrip1);
     toolStripStatusLabel1.Text = "";
 }
예제 #17
0
 private void BookshelfWindow_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((BookshelfManager)MdiParent).statusStrip1, WindowStatusStrip);
     ToolStripManager.RevertMerge(((BookshelfManager)MdiParent).toolStrip1, toolStrip1);
 }
예제 #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="toolbar"></param>
 public void ReverseToolbar(ToolStrip toolbar)
 {
     ToolStripManager.RevertMerge(window.tlsToolbar, toolbar);
 }
예제 #19
0
 private void StudentsForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)MdiParent).toolStrip1, toolStrip1);
     ToolStripManager.RevertMerge(((MainForm)MdiParent).statusStrip1, statusStrip1);
 }
예제 #20
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="statusbar"></param>
 public void ReverseStatusbar(StatusStrip statusbar)
 {
     ToolStripManager.RevertMerge(window.stsStatusbar, statusbar);
 }
예제 #21
0
 private void OnClosed_event(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge("mtoolStripMDI");
 }
예제 #22
0
 private void MusicForm_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)this.MdiParent).MainWindowStatus, StatusStrip);
 }
예제 #23
0
 private void QualityInquiry_Deactivate(object sender, EventArgs e)
 {
     frm.Search_Click -= new System.EventHandler(this.GetData);
     ToolStripManager.RevertMerge(frm.ToolStrip);
 }
예제 #24
0
파일: MainForm.cs 프로젝트: Gefix/Ilnet
        private void dockPanel_ActiveDocumentChanged(object sender, EventArgs e)
        {
            if (dockPanel.ActiveDocument != null)
            {
                if (dockPanel.ActiveDocument is IToolstripInterface)
                {
                    ToolStripPanel[] tspanels = new ToolStripPanel[] { tspTop, tspBottom, tspLeft, tspRight };

                    foreach (ToolStripPanel tp in tspanels)
                    {
                        foreach (ToolStrip ts in tp.Controls)
                        {
                            ts.AutoSize = false;
                            ToolStripManager.RevertMerge(ts);
                        }
                    }

                    foreach (ToolStrip tstrip in (dockPanel.ActiveDocument as IToolstripInterface).ToolStirps)
                    {
                        tstrip.Visible = false;

                        ToolStrip parentStrip = null;
                        foreach (ToolStripPanel tp in tspanels)
                        {
                            parentStrip = tp.Controls[tstrip.Name] as ToolStrip;
                            if (parentStrip != null)
                            {
                                break;
                            }
                        }

                        if (parentStrip == null)
                        {
                            parentStrip = new ToolStrip();
                            parentStrip.SuspendLayout();

                            parentStrip.Name = tstrip.Name;
                            parentStrip.Dock = System.Windows.Forms.DockStyle.None;
                            int left = 0;
                            foreach (ToolStrip ts in tspTop.Controls)
                            {
                                if (ts.Top == 0 && ts.Right > left)
                                {
                                    left = ts.Right;
                                }
                            }
                            parentStrip.Location = new System.Drawing.Point(left, 0);
                            parentStrip.TabIndex = 0;

                            this.tspTop.Controls.Add(parentStrip);

                            parentStrip.ResumeLayout(false);
                            parentStrip.PerformLayout();
                        }

                        ToolStripManager.Merge(tstrip, parentStrip);

                        parentStrip.Refresh();
                    }

                    foreach (ToolStripPanel tp in tspanels)
                    {
                        foreach (ToolStrip ts in tp.Controls)
                        {
                            if (ts.Items.Count <= 0)
                            {
                                //Settings
                                tp.Controls.Remove(ts);
                            }
                            else
                            {
                                ts.AutoSize = true;
                            }
                        }
                    }
                }
                if (dockPanel.ActiveDocument is IPropertyGridInterface)
                {
                    childSelectionChanged(dockPanel.ActiveDocument as IPropertyGridInterface);
                }
            }
        }
        public void MethodMergeToolStripsInsert()
        {
            // MergeAction = Insert
            ToolStrip ts1 = new ToolStrip();
            ToolStrip ts2 = new ToolStrip();

            ts1.Items.Add("ts1-A");
            ts1.Items.Add("ts1-B");
            ts1.Items.Add("ts1-C");
            ts1.Items.Add("ts1-D");

            ts2.Items.Add("ts2-A");
            ts2.Items.Add("ts2-B");
            ts2.Items.Add("ts2-C");
            ts2.Items.Add("ts2-D");

            ts2.Items[0].MergeAction = MergeAction.Insert;
            ts2.Items[0].MergeIndex  = 2;
            ts2.Items[1].MergeAction = MergeAction.Insert;
            ts2.Items[2].MergeAction = MergeAction.Insert;
            ts2.Items[2].MergeIndex  = 12;
            ts2.Items[3].MergeAction = MergeAction.Insert;
            ts2.Items[3].MergeIndex  = 0;

            ToolStripManager.Merge(ts2, ts1);

            Assert.AreEqual(7, ts1.Items.Count, "M1");
            Assert.AreEqual(1, ts2.Items.Count, "M2");

            Assert.AreEqual("ts2-D", ts1.Items[0].Text, "M3-1");
            Assert.AreEqual("ts1-A", ts1.Items[1].Text, "M3-2");
            Assert.AreEqual("ts1-B", ts1.Items[2].Text, "M3-3");
            Assert.AreEqual("ts2-A", ts1.Items[3].Text, "M3-4");
            Assert.AreEqual("ts1-C", ts1.Items[4].Text, "M3-5");
            Assert.AreEqual("ts1-D", ts1.Items[5].Text, "M3-6");
            Assert.AreEqual("ts2-C", ts1.Items[6].Text, "M3-7");
            Assert.AreEqual("ts2-B", ts2.Items[0].Text, "M3-8");

            ToolStripManager.RevertMerge(ts1, ts2);

            Assert.AreEqual(4, ts1.Items.Count, "M4");
            Assert.AreEqual(4, ts2.Items.Count, "M5");

            Assert.AreEqual("ts1-A", ts1.Items[0].Text, "M6-1");
            Assert.AreEqual("ts1-B", ts1.Items[1].Text, "M6-2");
            Assert.AreEqual("ts1-C", ts1.Items[2].Text, "M6-3");
            Assert.AreEqual("ts1-D", ts1.Items[3].Text, "M6-4");
            Assert.AreEqual("ts2-A", ts2.Items[0].Text, "M6-5");
            Assert.AreEqual("ts2-B", ts2.Items[1].Text, "M6-6");
            Assert.AreEqual("ts2-C", ts2.Items[2].Text, "M6-7");
            Assert.AreEqual("ts2-D", ts2.Items[3].Text, "M6-8");

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

            Assert.AreEqual(7, ts1.Items.Count, "M7");
            Assert.AreEqual(1, ts2.Items.Count, "M8");

            Assert.AreEqual("ts2-D", ts1.Items[0].Text, "M9-1");
            Assert.AreEqual("ts1-A", ts1.Items[1].Text, "M9-2");
            Assert.AreEqual("ts1-B", ts1.Items[2].Text, "M9-3");
            Assert.AreEqual("ts2-A", ts1.Items[3].Text, "M9-4");
            Assert.AreEqual("ts1-C", ts1.Items[4].Text, "M9-5");
            Assert.AreEqual("ts1-D", ts1.Items[5].Text, "M9-6");
            Assert.AreEqual("ts2-C", ts1.Items[6].Text, "M9-7");
            Assert.AreEqual("ts2-B", ts2.Items[0].Text, "M9-8");

            ToolStripManager.RevertMerge(ts1, ts2);

            Assert.AreEqual(4, ts1.Items.Count, "M10");
            Assert.AreEqual(4, ts2.Items.Count, "M11");

            Assert.AreEqual("ts1-A", ts1.Items[0].Text, "M12-1");
            Assert.AreEqual("ts1-B", ts1.Items[1].Text, "M12-2");
            Assert.AreEqual("ts1-C", ts1.Items[2].Text, "M12-3");
            Assert.AreEqual("ts1-D", ts1.Items[3].Text, "M12-4");
            Assert.AreEqual("ts2-A", ts2.Items[0].Text, "M12-5");
            Assert.AreEqual("ts2-B", ts2.Items[1].Text, "M12-6");
            Assert.AreEqual("ts2-C", ts2.Items[2].Text, "M12-7");
            Assert.AreEqual("ts2-D", ts2.Items[3].Text, "M12-8");
        }
예제 #26
0
        /// <summary>
        /// Opens an object using the main thread containing a message handler.
        /// </summary>
        /// <param name="viewerObject">The object to be opened.</param>
        private void OpenObjectInForeground(object viewerObject)
        {
            try
            {
                // Activate the application when opening an object.  This is used in situations where a notification comes in while
                // another application is active.  When the user clicks on the notification widow, they will be routed to this
                // application, which then needs to be active to take the user's input.
                this.Activate();

                // Close down any documents that are currently open in the viewer.
                if (this.activeViewer != null)
                {
                    this.activeViewer.Close();
                }

                // If an object type was selected that doesn't have a viewer (or the viewer couldn't be loaded), then
                // reject the operation and leave the last viewer up.
                Viewer viewer = this.viewerTable[viewerObject.GetType()];
                if (viewer == null)
                {
                    throw new Exception("Viewer not found");
                }

                // This will synchronize the navigators with the open document.
                this.folderList.Open(viewerObject);
                this.guardianBar.Open(viewerObject);
                this.Text = viewerObject.ToString() + " - " + Properties.Settings.Default.ApplicationName;

                // This is an optimization: if the viewer for the current object is the same as the viewer for the last
                // object, then we'll skip the step of swapping the screen elements around and just reuse the current
                // viewer.  Otherwise, there's some modest reorgainization of the screen required to activate the proper
                // viewer.
                if (this.activeViewer != viewer)
                {
                    // The code below will modify the layout of the FormMain frame window.  It will swap out the current
                    // viewer its menus and toolbars and replace it with the new viewer and it's resources.  Suspending
                    // the layout will minimize the screen distractions.
                    SuspendLayout();

                    // Swap the new active viewer with the previous one.  Also, have the viewer cleared out so it's empty
                    // the next time it's activated.  This gets rid of the disturbing effect of seeing the previous data
                    // when you select a new report.  It shows up momentarily while the new document is constructed.
                    // Clearing it out now will give it a chance to create a blank report in the background.
                    viewer.BringToFront();

                    this.menuStrip.SuspendLayout();
                    this.toolStrip.SuspendLayout();

                    // Clear the previous menu and tools from the child viewer out of the main container area.
                    ToolStripManager.RevertMerge(this.menuStrip);
                    ToolStripManager.RevertMerge(this.toolStrip);

                    // Merge the container's menu with the menu of the active viewer.
                    ToolStripManager.Merge(viewer.MenuStrip, this.menuStrip);
                    ToolStripManager.Merge(viewer.ToolBarStandard, this.toolStrip);

                    this.menuStrip.ResumeLayout();
                    this.toolStrip.ResumeLayout();

                    // Let the screen process the changes.
                    this.ResumeLayout();

                    this.activeViewer = viewer;
                }

                // Opening is a somewhat involved operation.  Because it may take a few seconds to open a report, the
                // message loop can't be suspended while the user waits.  The operation is done asynchronously.  This
                // operation will kick off an asynchronous operation in the viewer that will gather all the resources
                // needed and draw the document.  When that operation is complete, the viewer will kick off an event that
                // will signal the 'Open' operation is complete.  At that point, a message will be broadcast from the
                // control and picked up by the 'viewer_EndOpenDocument' method below which will complete the operation of
                // opening the viewer and document.
                this.activeViewer.Open(viewerObject);
            }
            catch (Exception exception)
            {
                // These user interface errors need to be show to the users.
                MessageBox.Show(exception.Message, "Guardian Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
        public void MethodRevertMergeNullArgument1()
        {
            String ts = null;

            Assert.AreEqual(false, ToolStripManager.RevertMerge(ts), "C1");
        }
예제 #28
0
 private void NoticeRegister_Deactivate(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(main.ToolStrip);
 }
        public void MethodRevertMergeNullArgument3()
        {
            ToolStrip ts = new ToolStrip();

            ToolStripManager.RevertMerge(ts, null);
        }
예제 #30
0
 private void VehiclesForm_Deactivated(object sender, EventArgs e)
 {
     ToolStripManager.RevertMerge(((MainForm)MdiParent).toolStrip1, toolStrip1);
 }