private void InitializeBottomToolStripPanel()
        {
            bottomToolStrip = new ToolStripPanel()
            {
                Parent = this,
                Dock   = DockStyle.Bottom,
            };

            statusStrip = new StatusStrip()
            {
                Parent     = bottomToolStrip,
                Dock       = DockStyle.Bottom,
                SizingGrip = true,
                GripStyle  = ToolStripGripStyle.Visible,
            };
            bottomToolStrip.Join(statusStrip);

            statusLabel = new ToolStripStatusLabel()
            {
                Text      = "Ready",
                Spring    = true,
                TextAlign = ContentAlignment.MiddleLeft,
            };
            statusStrip.Items.Add(statusLabel);
        }
        [SuppressMessage("Microsoft.Design", "CA1062")]         //The parameter array is actually checked.
        public static void SetToolStripRenderer(ToolbarTheme theme, params Control[] toolStrips)
        {
            foreach (Control ts in toolStrips)
            {
                if (ts == null)
                {
                    throw new ArgumentNullException("toolStrips", "ToolStrips cannot contain a null reference.");
                }
            }

            foreach (Control ts in toolStrips)
            {
                if (ts is ToolStrip)
                {
                    ToolStrip t = (ToolStrip)ts;
                    t.Renderer = new NativeToolStripRenderer(t, theme);
                }
                else if (ts is ToolStripPanel)
                {
                    ToolStripPanel t = (ToolStripPanel)ts;
                    t.Renderer = new NativeToolStripRenderer(t, theme);
                }
                else
                {
                    throw new ArgumentException("Can't set the renderer for a " + ts.GetType().Name);
                }
            }
        }
Example #3
0
        void SetupToolbars()
        {
            MenuItem mmitem = m_menuItems.GetItem("New");

            mmitem.Text        = "&New";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.NewDocument);
            mmitem.Click      += new EventHandler(OnFileNew);
            mmitem.ToolTipText = "New document";

            mmitem             = m_menuItems.GetItem("Open");
            mmitem.Text        = "&Open";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.OpenDocument);
            mmitem.Click      += new EventHandler(OnFileOpen);
            mmitem.ToolTipText = "Open document";

            mmitem             = m_menuItems.GetItem("Save");
            mmitem.Text        = "&Save";
            mmitem.Image       = MenuImages16x16.Image(MenuImages16x16.eIndexes.SaveDocument);
            mmitem.Click      += new EventHandler(OnFileSave);
            mmitem.ToolTipText = "Save document";

            mmitem        = m_menuItems.GetItem("SaveAs");
            mmitem.Text   = "Save &As";
            mmitem.Click += new EventHandler(OnFileSaveAs);

            mmitem        = m_menuItems.GetItem("Exit");
            mmitem.Text   = "E&xit";
            mmitem.Click += new EventHandler(OnFileExit);

            ToolStrip strip = m_menuItems.GetStrip("file");

            strip.Items.Add(m_menuItems.GetItem("New").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Open").CreateButton());
            strip.Items.Add(m_menuItems.GetItem("Save").CreateButton());

            ToolStripMenuItem menuitem = m_menuItems.GetMenuStrip("file");

            menuitem.Text = "&File";
            menuitem.DropDownItems.Add(m_menuItems.GetItem("New").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Open").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Save").CreateMenuItem());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("SaveAs").CreateMenuItem());
            menuitem.DropDownItems.Add(new ToolStripSeparator());
            menuitem.DropDownItems.Add(m_menuItems.GetItem("Exit").CreateMenuItem());
            m_mainMenu.Items.Insert(0, menuitem);

            ToolStripPanel panel = m_menuItems.GetStripPanel(DockStyle.Top);

            panel.Join(m_menuItems.GetStrip("layer"));
            panel.Join(m_menuItems.GetStrip("draw"));
            panel.Join(m_menuItems.GetStrip("edit"));
            panel.Join(m_menuItems.GetStrip("file"));
            panel.Join(m_mainMenu);

            panel = m_menuItems.GetStripPanel(DockStyle.Left);
            panel.Join(m_menuItems.GetStrip("modify"));

            panel = m_menuItems.GetStripPanel(DockStyle.Bottom);
            panel.Join(m_menuItems.GetStatusStrip("status"));
        }
Example #4
0
        /// <inheritdoc />
        public void Activate()
        {
            if (_isActivated)
            {
                return;
            }

            var headerControls = App.CompositionContainer.GetExportedValues <IHeaderControl>().ToList();

            // Activate only if there are no other IHeaderControl implementations and
            // custom HeaderControl not yet set
            if (App.HeaderControl == null && headerControls.Count == 1 && headerControls[0].GetType() == GetType())
            {
                _isActivated = true;

                var container = new ToolStripPanel
                {
                    Dock = DockStyle.Top
                };
                Shell.Controls.Add(container);

                var menuStrip = new MenuStrip
                {
                    Name = DefaultGroupName,
                    Dock = DockStyle.Top
                };
                Shell.Controls.Add(menuStrip);

                Initialize(container, menuStrip);
                App.ExtensionsActivated += (sender, args) => LoadToolstrips();

                // Add default buttons
                new DefaultMenuBars(App).Initialize(this);
            }
        }
Example #5
0
        private static ArrayList WalkControls(Control.ControlCollection cc)
        {
            ArrayList arl = new ArrayList();

            if (cc != null)
            {
                foreach (Control c1 in cc)
                {
                    if (typeof(ToolStripPanel).IsInstanceOfType(c1))
                    {
                        ToolStripPanel ts = (ToolStripPanel)c1;
                        foreach (Control c in ts.Controls)
                        {
                            arl.Add(new Lewis.SST.Settings.CtrlSettings(c.Name, c.Location, c.Size, ts.Dock.ToString(), c.GetType().ToString()));
                        }
                    }
                    if (typeof(SQLServerExplorer).IsInstanceOfType(c1))
                    {
                        SQLServerExplorer sse = (SQLServerExplorer)c1;
                        foreach (SQLConnection sql in sse.SQLConnections)
                        {
                            arl.Add(new Lewis.SST.Settings.CtrlSettings(sql.Server, sql.EncryptedConnectionString + "\\" + sql.SavePassword.ToString(), sql.GetType().ToString()));
                        }
                    }
                    arl.AddRange(WalkControls(c1.Controls));
                }
            }
            return(arl);
        }
        private void ExpandPanel(ToolStripPanel panel, bool select)
        {
            const int panelHeight = 25;

            switch (panel.Dock)
            {
            case DockStyle.Top:
                panel.Padding = new Padding(0, 0, 0, panelHeight);
                break;

            case DockStyle.Bottom:
                panel.Padding = new Padding(0, panelHeight, 0, 0);
                break;

            case DockStyle.Left:
                panel.Padding = new Padding(0, 0, panelHeight, 0);
                break;

            case DockStyle.Right:
                panel.Padding = new Padding(panelHeight, 0, 0, 0);
                break;
            }

            if (select)
            {
                ISelectionService service = GetService <ISelectionService>();
                if (service != null)
                {
                    service.SetSelectedComponents(new object[] { panel }, SelectionTypes.Replace);
                }
            }
        }
        protected override void OnLocationChanged(EventArgs e)
        {
            if (this.Parent is ToolStripPanel)
            {
                ToolStripPanel parent = this.Parent as ToolStripPanel;

                if (parent.Orientation == Orientation.Horizontal)
                {
                    if (this.Location.Y != 0)
                    {
                        this.Location = new Point(this.Location.X, 0);
                        return;
                    }
                }
                else if (parent.Orientation == Orientation.Vertical)
                {
                    if (this.Location.X != 0)
                    {
                        this.Location = new Point(0, this.Location.Y);
                        return;
                    }
                }
            }
            base.OnLocationChanged(e);
        }
Example #8
0
        private static void WritePanel(XmlNode parentNode, ToolStripPanel toolStripPanel, string toolStripPanelName)
        {
            var node = Xml.SetNewValue(parentNode, "Panel", string.Empty);

            Xml.SetAttribute(node, "name", toolStripPanelName);
            var list  = new List <ToolStrip>();
            var list2 = new List <Control>();

            foreach (var row in toolStripPanel.Rows)
            {
                list2.Clear();
                list2.AddRange(row.Controls);
                list2.Sort(delegate(Control control1, Control control2) {
                    var x1 = control1.Location.X;
                    var y1 = control1.Location.Y;

                    var x2 = control2.Location.X;
                    var y2 = control2.Location.Y;

                    return(y1 == y2 ? x1.CompareTo(x2) : y1.CompareTo(y2));
                });
                list.AddRange(list2.Cast <ToolStrip>());
            }
            foreach (var control in list)
            {
                var node2 = Xml.SetNewValue(node, "Strip", string.Empty);
                Xml.SetAttribute(node2, "name", control.Name);
                Xml.SetAttribute(node2, "location", string.Format("{0},{1}", control.Location.X, control.Location.Y));
                Xml.SetAttribute(node2, "visible", control.Visible.ToString());
            }
        }
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent( )
 {
     this.tsPanel = new System.Windows.Forms.ToolStripPanel();
     this.SuspendLayout();
     //
     // tsPanel
     //
     this.tsPanel.Dock        = System.Windows.Forms.DockStyle.Top;
     this.tsPanel.Location    = new System.Drawing.Point(0, 0);
     this.tsPanel.Margin      = new System.Windows.Forms.Padding(3);
     this.tsPanel.Name        = "tsPanel";
     this.tsPanel.Orientation = System.Windows.Forms.Orientation.Horizontal;
     this.tsPanel.RowMargin   = new System.Windows.Forms.Padding(3, 0, 0, 0);
     this.tsPanel.Size        = new System.Drawing.Size(984, 0);
     //
     // MFDesigner
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.BackColor           = System.Drawing.Color.Gainsboro;
     this.ClientSize          = new System.Drawing.Size(984, 632);
     this.Controls.Add(this.tsPanel);
     this.ForeColor = System.Drawing.Color.Black;
     this.Name      = "MFDesigner";
     this.Text      = "MFDesigner";
     this.Load     += new System.EventHandler(this.MFDesigner_Load);
     this.Resize   += new System.EventHandler(this.MFDesigner_Resize);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Example #10
0
        private static ToolStripDock ConvertToToolStripDock(ToolStripContainer toolStripContainer, ToolStrip toolStrip)
        {
            ToolStripPanel parent = toolStrip.Parent as ToolStripPanel;

            if (ReferenceEquals(parent, toolStripContainer.TopToolStripPanel))
            {
                return(ToolStripDock.Top);
            }
            else if (ReferenceEquals(parent, toolStripContainer.LeftToolStripPanel))
            {
                return(ToolStripDock.Left);
            }
            else if (ReferenceEquals(parent, toolStripContainer.BottomToolStripPanel))
            {
                return(ToolStripDock.Bottom);
            }
            else if (ReferenceEquals(parent, toolStripContainer.RightToolStripPanel))
            {
                return(ToolStripDock.Right);
            }
            else
            {
                return(ToolStripDock.None);
            }
        }
Example #11
0
        /// <summary>
        /// Initializes the specified container.
        /// </summary>
        /// <param name="toolStripPanel">The tool strip panel.</param>
        /// <param name="menuStrip">Menu strip.</param>
        public void Initialize(ToolStripPanel toolStripPanel, MenuStrip menuStrip)
        {
            if (toolStripPanel == null)
            {
                throw new ArgumentNullException(nameof(toolStripPanel));
            }
            if (menuStrip == null)
            {
                throw new ArgumentNullException(nameof(menuStrip));
            }

            if (_tsPanel != null)
            {
                RemoveAll();
                _menuStrip.ItemClicked      -= MenuStripItemClicked;
                _tsPanel.Layout             -= RememberLayout;
                Application.ApplicationExit -= SaveToolstripPositions;
                _stripPosList.Clear();
            }

            _tsPanel         = toolStripPanel;
            _tsPanel.Layout += RememberLayout;
            LoadToolstripPositions();
            Application.ApplicationExit += SaveToolstripPositions;
            _menuStrip              = menuStrip;
            _menuStrip.ItemClicked += MenuStripItemClicked;
            _strips = new List <ToolStrip>
            {
                _menuStrip
            };
            if (_stripPosList.Count == 0) // set the default position of the menustrip for it to show on top
            {
                _stripPosList.Add(new ToolstripPosition(_menuStrip.Name, 0, 0));
            }
        }
Example #12
0
        public void Load(IPersistStream stream)
        {
            if (_toolbar == null)
            {
                return;
            }
            _toolbar.Load(stream);

            this.Visible = (bool)stream.Load("visible", true);
            _panel       = (ToolbarPanel)stream.Load("panel", (int)ToolbarPanel.top);

            int x = (int)stream.Load("x", 0);
            int y = (int)stream.Load("y", 0);

            if (x >= 0 && y >= 0)
            {
                if (!this.Visible && x == 0 && y == 0)
                {
                    y += 350;
                }
                this.Location = new System.Drawing.Point(x, y);
            }
            ToolStripPanel toolStripPanel = this.ToolPanel(_panel);

            if (toolStripPanel != null && this.Parent != toolStripPanel)
            {
                if (this.Parent != null)
                {
                    this.Parent.Controls.Remove(this);
                }
                toolStripPanel.Controls.Add(this);
            }
        }
        public void AutoSize_SetWithHandler_CallsAutoSizeChanged()
        {
            var          panel     = new ToolStripPanel();
            int          callCount = 0;
            EventHandler handler   = (sender, e) =>
            {
                Assert.Same(panel, sender);
                Assert.Same(EventArgs.Empty, e);
                callCount++;
            };

            panel.AutoSizeChanged += handler;

            // Set different.
            panel.AutoSize = false;
            Assert.False(panel.AutoSize);
            Assert.Equal(1, callCount);

            // Set same.
            panel.AutoSize = false;
            Assert.False(panel.AutoSize);
            Assert.Equal(1, callCount);

            // Set different.
            panel.AutoSize = true;
            Assert.True(panel.AutoSize);
            Assert.Equal(2, callCount);

            // Remove handler.
            panel.AutoSizeChanged -= handler;
            panel.AutoSize         = false;
            Assert.False(panel.AutoSize);
            Assert.Equal(2, callCount);
        }
Example #14
0
 /// <summary>
 /// 返回指定的下拉列表框
 /// </summary>
 /// <param name="name">要查找条目的名字</param>
 public Interfaces.ComboBoxItem ComboBoxItem(string name)
 {
     try
     {
         ToolStripComboBox item;
         ToolStrip         strip;
         ToolStripPanel    topPanel = Program.frmMain.StripDocker.TopToolStripPanel;
         for (int i = 0; i < topPanel.Controls.Count; i++) //遍历TopPanel中的对象
         {
             strip = topPanel.Controls[i] as ToolStrip;
             if (strip != null)                              //找到ToolStrip类型的对象
             {
                 for (int j = 0; i < strip.Items.Count; j++) //遍历Toolstrip中的对象
                 {
                     item = strip.Items[j] as ToolStripComboBox;
                     if (item != null && item.Name == name) //找到ToolStripComboBox对象,比对
                     {
                         return(new ComboBoxItem(item));
                     }
                 }
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         Program.ShowError(ex);
         return(null);
     }
 }
        public void AddToolStrip()
        {
            // add debug toolbar right to the main toolbar
            ToolStripPanel tsp = PluginBase.MainForm.ToolStripPanel;

            if (tsp.Rows.Length > 1)
            {
                int       idx = tsp.Rows.Length - 1;
                Control[] row = tsp.Rows[idx].Controls;
                foreach (Control c in row)
                {
                    tsp.Controls.Remove(c);
                }

                tsp.Join(m_DebuggerToolStrip, idx);
                for (int i = row.Length - 1; i >= 0; i--)
                {
                    tsp.Join(row[0] as ToolStrip, idx);
                }
            }
            else
            {
                tsp.Join(m_DebuggerToolStrip);
            }
        }
Example #16
0
        private void OnToolStripSettingsPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            ToolStripSettings settings = ToolStripSettings.Default;

            if (e.PropertyName == "WrapLongToolstrips" || e.PropertyName == "ToolStripDock")
            {
                // handle both wrapping and docking together because both affect flow direction
                bool verticalOrientation = ReferenceEquals(_toolbar.Parent, _toolStripContainer.LeftToolStripPanel) ||
                                           ReferenceEquals(_toolbar.Parent, _toolStripContainer.RightToolStripPanel);

                _toolbar.SuspendLayout();
                _toolbar.LayoutStyle = settings.WrapLongToolstrips ? ToolStripLayoutStyle.Flow : ToolStripLayoutStyle.StackWithOverflow;
                if (settings.WrapLongToolstrips)
                {
                    ((FlowLayoutSettings)_toolbar.LayoutSettings).FlowDirection = verticalOrientation ? FlowDirection.TopDown : FlowDirection.LeftToRight;
                }
                _toolbar.ResumeLayout(true);

                ToolStripPanel targetParent = ConvertToToolStripPanel(_toolStripContainer, settings.ToolStripDock);
                if (targetParent != null && !ReferenceEquals(targetParent, _toolbar.Parent))
                {
                    _toolStripContainer.SuspendLayout();
                    targetParent.Join(_toolbar);

                    _toolStripContainer.ResumeLayout(true);
                }
            }
            else if (e.PropertyName == "IconSize")
            {
                ToolStripBuilder.ChangeIconSize(_toolbar, settings.IconSize);
            }
        }
        public void Attach(IWorkbench workbench)
        {
            wbForm = (DefaultWorkbench)workbench;
            wbForm.SuspendLayout();
            wbForm.Controls.Clear();

            mainMenuContainer      = new AutoHideMenuStripContainer(wbForm.TopMenu);
            mainMenuContainer.Dock = DockStyle.Top;

            statusStripContainer      = new AutoHideStatusStripContainer((StatusStrip)StatusBarService.Control);
            statusStripContainer.Dock = DockStyle.Bottom;

            toolBarPanel = new ToolStripPanel();
            if (wbForm.ToolBars != null)
            {
                toolBarPanel.Controls.AddRange(wbForm.ToolBars);
            }
            toolBarPanel.Dock = DockStyle.Top;

            dockPanel      = new DockPanel();
            dockPanel.Dock = DockStyle.Fill;
            dockPanel.RightToLeftLayout = true;

            // Known issues with certain DocumentStyles:
            //   DockingMdi:
            //    - this is the default value
            //    - after switching between layouts, text editor tooltips sometimes do not show up anymore
            //   DockingSdi:
            //    - in this mode, the tab bar is not shown when there is only one open window
            //   DockingWindow:
            //    - SharpDevelop 2.x used this mode
            //    - it was also the only mode supported by the early DockPanelSuite versions used by SharpDevelop 1.x

            dockPanel.DocumentStyle = DocumentStyle.DockingWindow;

            wbForm.Controls.Add(dockPanel);
            wbForm.Controls.Add(toolBarPanel);
            wbForm.Controls.Add(mainMenuContainer);
            wbForm.Controls.Add(statusStripContainer);
            wbForm.MainMenuStrip = wbForm.TopMenu;
            // dock panel has to be added to the form before LoadLayoutConfiguration is called to fix SD2-463

            LoadLayoutConfiguration();
            ShowPads();

            ShowViewContents();

            RedrawAllComponents();

            dockPanel.ActiveDocumentChanged += new EventHandler(ActiveMdiChanged);
            dockPanel.ActiveContentChanged  += new EventHandler(ActiveContentChanged);
            ActiveMdiChanged(this, EventArgs.Empty);

            wbForm.ResumeLayout(false);

            Properties fullscreenProperties = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.FullscreenOptions", new Properties());

            fullscreenProperties.PropertyChanged += TrackFullscreenPropertyChanges;
        }
Example #18
0
 public void DisposeToolStripPanel(ToolStripPanel panel)
 {
     foreach (Control control in panel.Controls)
     {
         control.Dispose();
     }
     panel.Dispose();
 }
Example #19
0
 private static void SaveToolStripPanel(ToolStripPanel panel, String position, ToolStripSettings newSettings)
 {
     for (Int32 rowIndex = 0; rowIndex < panel.Rows.Length; rowIndex++)
     {
         ToolStripPanelRow row = panel.Rows[rowIndex];
         SaveToolStripRow(row, newSettings, position, rowIndex);
     }
 }
        public void Ctor_Graphics_ToolStripPanel(Graphics g, ToolStripPanel panel)
        {
            var e = new ToolStripPanelRenderEventArgs(g, panel);

            Assert.Equal(g, e.Graphics);
            Assert.Equal(panel, e.ToolStripPanel);
            Assert.False(e.Handled);
        }
Example #21
0
        static void SavePanelState(ToolStripPanel panel, string panelName, XmlDocument xmlDoc, XmlElement root)
        {
            XmlElement panelElement = xmlDoc.CreateElement("ToolStripPanel");

            root.AppendChild(panelElement);
            panelElement.SetAttribute("Name", panelName);

            foreach (ToolStrip toolStrip in panel.Controls)
            {
                // skip invisible or unnamed  toolStrip
                if (!toolStrip.Visible || toolStrip.Name == null || toolStrip.Name.Trim().Length == 0)
                {
                    continue;
                }

                XmlElement toolStripElement = xmlDoc.CreateElement("ToolStrip");
                panelElement.AppendChild(toolStripElement);

                toolStripElement.SetAttribute("Name", toolStrip.Name);
                toolStripElement.SetAttribute("Location", string.Format("{0},{1}", toolStrip.Location.X, toolStrip.Location.Y));

                // don't persist menu strip items
                if (toolStrip is MenuStrip)
                {
                    continue;
                }

                foreach (ToolStripItem item in toolStrip.Items)
                {
                    // skip unnamed tool strip items
                    if (item.Name == null || item.Name.Trim().Length == 0)
                    {
                        continue;
                    }

                    XmlElement itemElement = xmlDoc.CreateElement("ToolStripItem");
                    toolStripElement.AppendChild(itemElement);

                    itemElement.SetAttribute("Name", item.Name);

                    // Buttons that are in the Overflow area have Visible set to false but Available to true.
                    // We want to identify buttons that have been intentially made not visible
                    //  through use of the Customize drop-down menu. See AddCustomizationDropDown()
                    //  in CommandService.
                    if (!(item is ToolStripDropDownButton) &&
                        item.Placement == ToolStripItemPlacement.None &&
                        item.Available == false)
                    {
                        itemElement.SetAttribute("Visible", "false");
                    }

                    if ((item is ToolStripButton) && ((ToolStripButton)item).Checked)
                    {
                        itemElement.SetAttribute("Checked", "true");
                    }
                }
            }
        }
 internal ToolStripPanelSelectionBehavior(ToolStripPanel containerControl, IServiceProvider serviceProvider)
 {
     this.behaviorService = (BehaviorService)serviceProvider.GetService(typeof(BehaviorService));
     if (this.behaviorService != null)
     {
         this.relatedControl  = containerControl;
         this.serviceProvider = serviceProvider;
     }
 }
Example #23
0
 internal ToolbarAreaConfiguration(ToolStripPanel area)
 {
     m_Name = area.Name;
     m_RowConfigurations = new ToolbarRowConfiguration[area.Rows.Length];
     for (int rowIndex = 0; rowIndex < area.Rows.Length; rowIndex++)
     {
         m_RowConfigurations[rowIndex] = new ToolbarRowConfiguration(area.Rows[rowIndex], rowIndex);
     }
 }
Example #24
0
        private void AppendToolStrips(int row, IList <ToolStrip> toolStrips)
        {
            ToolStripPanel panel = toolStripContainer1.TopToolStripPanel;

            for (int i = toolStrips.Count; --i >= 0;)
            {
                panel.Join(toolStrips[i], row);
            }
        }
Example #25
0
        private void PanelSizeChanged(object sender, EventArgs e)
        {
            ToolStripPanel toolStripPanel = sender as ToolStripPanel;

            if (toolStripPanel != null)
            {
                toolStripPanel.Invalidate(true);
            }
        }
Example #26
0
        // Using just ToolStripManager.Renderer without setting the Renderer individually per ToolStrip means
        // that the ToolStrip is not passed to the Initialize method. ToolStripPanels, however, are. So we can
        // simply initialize it here too, and this should guarantee that the ToolStrip is initialized at least
        // once. Hopefully it isn't any more complicated than this.
        protected override void InitializePanel(ToolStripPanel toolStripPanel)
        {
            foreach (ToolStrip c in toolStripPanel.Controls.OfType <ToolStrip>())
            {
                this.Initialize(c);
            }

            base.InitializePanel(toolStripPanel);
        }
Example #27
0
        /// <summary>
        /// This prevents odd positioning issues due to toolbar load order.
        /// Since all toolbars start in this temp panel, no toolbar load
        /// can be blocked by pre-existing toolbars.
        /// </summary>
        private void ResetAllToolbarLocations()
        {
            var tempToolStrip = new ToolStripPanel();

            tempToolStrip.Join(_mainMenu);
            tempToolStrip.Join(_quickConnectToolStrip);
            tempToolStrip.Join(_externalToolsToolStrip);
            tempToolStrip.Join(_multiSshToolStrip);
        }
Example #28
0
 /// <summary>
 /// 创建工具栏面板
 /// </summary>
 /// <param name="dockedLocation">指定控件的位置和控件停靠的方式。</param>
 void CreateStripPanel(DockStyle dockedLocation)
 {
     if (m_owner != null && GetStripPanel(dockedLocation) == null)
     {
         ToolStripPanel panel = new ToolStripPanel();
         panel.Dock = dockedLocation;
         m_owner.Controls.Add(panel);
     }
 }
Example #29
0
 public VirtualMenuTree(IContext context, MenuStrip menuStrip, ToolStripPanel toolStrip, List <MenuSection> declaredSections, List <MenuGroup> declaredGroups)
 {
     _context          = context;
     _declaredSections = declaredSections;
     _declaredGroups   = declaredGroups;
     MenuStrip         = menuStrip;
     ToolStrip         = toolStrip;
     RootNodes         = new Dictionary <string, MenuTreeRoot>();
     Clear();
 }
Example #30
0
        // Append toolstrips to the ToolStrip Panel
        private void AppendToolStrips(int row, IList <ToolStrip> toolStrips)
        {
            ToolStripPanel topToolStripPanel = toolStripContainer.TopToolStripPanel;
            int            num = toolStrips.Count;

            while (--num >= 0)
            {
                topToolStripPanel.Join(toolStrips[num], row);
            }
        }
Example #31
0
    // Using just ToolStripManager.Renderer without setting the Renderer individually per ToolStrip means
    // that the ToolStrip is not passed to the Initialize method. ToolStripPanels, however, are. So we can
    // simply initialize it here too, and this should guarantee that the ToolStrip is initialized at least
    // once. Hopefully it isn't any more complicated than this.
    protected override void InitializePanel(ToolStripPanel toolStripPanel)
    {
        foreach (Control control in toolStripPanel.Controls)
            if (control is ToolStrip)
                Initialize((ToolStrip)control);

        base.InitializePanel(toolStripPanel);
    }
 // Constructors
 public ToolStripPanelRenderEventArgs(System.Drawing.Graphics g, ToolStripPanel toolStripPanel)
 {
 }
Example #33
0
	public MainForm()
	{
		// 
		// _rightPanel
		// 
		_rightPanel = new ToolStripPanel ();
		_rightPanel.Dock = DockStyle.Right;
		Controls.Add (_rightPanel);
		// 
		// _leftPanel
		// 
		_leftPanel = new ToolStripPanel ();
		_leftPanel.Dock = DockStyle.Left;
		Controls.Add (_leftPanel);
		// 
		// _bottomPanel
		// 
		_bottomPanel = new ToolStripPanel ();
		_bottomPanel.Dock = DockStyle.Bottom;
		Controls.Add (_bottomPanel);
		// 
		// _topPanel
		// 
		_topPanel = new ToolStripPanel ();
		_topPanel.Dock = DockStyle.Top;
		Controls.Add (_topPanel);
		// 
		// _topStrip
		// 
		_topStrip = new ToolStrip ();
		_topStrip.Items.Add ("Top");
		_topPanel.Join (_topStrip);
		// 
		// _bottomStrip
		// 
		_bottomStrip = new ToolStrip ();
		_bottomStrip.Items.Add ("Bottom");
		_bottomPanel.Join (_bottomStrip);
		// 
		// _leftStrip
		// 
		_leftStrip = new ToolStrip ();
		_leftStrip.Items.Add ("Left");
		_leftPanel.Join (_leftStrip);
		// 
		// _leftStrip
		// 
		_rightStrip = new ToolStrip();
		_rightStrip.Items.Add ("Right");
		_rightPanel.Join (_rightStrip);
		// 
		// _menuStrip
		// 
		_menuStrip = new MenuStrip ();
		_menuStrip.Dock = DockStyle.Top;
		Controls.Add (_menuStrip);
		// 
		// _windowMenu
		// 
		_windowMenu = new ToolStripMenuItem ("Window");
		_menuStrip.MdiWindowListItem = _windowMenu;
		((ToolStripDropDownMenu) (_windowMenu.DropDown)).ShowImageMargin = false;
		((ToolStripDropDownMenu) (_windowMenu.DropDown)).ShowCheckMargin = true;
		_menuStrip.Items.Add (_windowMenu);
		// 
		// _newWindowMenu
		// 
		_newWindowMenu = new ToolStripMenuItem ("New", null, new EventHandler (NewWindowMenu_Click));
		_windowMenu.DropDownItems.Add (_newWindowMenu);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 300);
		IsMdiContainer = true;
		Location = new Point (250, 100);
		MainMenuStrip = _menuStrip;
		StartPosition = FormStartPosition.Manual;
		Text = "bug #341998";
		Load += new EventHandler (MainForm_Load);
	}
 // Constructors
 public ToolStripPanelRow(ToolStripPanel parent)
 {
 }
 // Constructors
 public ToolStripPanelRowCollection(ToolStripPanel owner)
 {
 }
 public ToolStripPanelRowCollection(ToolStripPanel owner, ToolStripPanelRow[] value)
 {
 }
        // Using just ToolStripManager.Renderer without setting the Renderer individually per ToolStrip means
        // that the ToolStrip is not passed to the Initialize method. ToolStripPanels, however, are. So we can 
        // simply initialize it here too, and this should guarantee that the ToolStrip is initialized at least 
        // once. Hopefully it isn't any more complicated than this.
        protected override void InitializePanel(ToolStripPanel toolStripPanel)
        {
            foreach (ToolStrip c in toolStripPanel.Controls.OfType<ToolStrip>())
            {
                this.Initialize(c);
            }

            base.InitializePanel(toolStripPanel);
        }