Пример #1
0
            public void AddRange(ToolStripPanelRowCollection value)
            {
                ArgumentNullException.ThrowIfNull(value);

                ToolStripPanel currentOwner = _owner;

                if (currentOwner is not null)
                {
                    currentOwner.SuspendLayout();
                }

                try
                {
                    int currentCount = value.Count;
                    for (int i = 0; i < currentCount; i++)
                    {
                        Add(value[i]);
                    }
                }
                finally
                {
                    if (currentOwner is not null)
                    {
                        currentOwner.ResumeLayout();
                    }
                }
            }
            public void AddRange(Control[] value)
            {
                if (value is null)
                {
                    throw new ArgumentNullException(nameof(value));
                }

                ToolStripPanel currentOwner = ToolStripPanel;

                if (currentOwner != null)
                {
                    currentOwner.SuspendLayout();
                }

                try
                {
                    for (int i = 0; i < value.Length; i++)
                    {
                        Add(value[i]);
                    }
                }
                finally
                {
                    if (currentOwner != null)
                    {
                        currentOwner.ResumeLayout();
                    }
                }
            }
Пример #3
0
            public void AddRange(ToolStripPanelRow[] value)
            {
                ArgumentNullException.ThrowIfNull(value);

                ToolStripPanel currentOwner = _owner;

                if (currentOwner is not null)
                {
                    currentOwner.SuspendLayout();
                }

                try
                {
                    for (int i = 0; i < value.Length; i++)
                    {
                        Add(value[i]);
                    }
                }
                finally
                {
                    if (currentOwner is not null)
                    {
                        currentOwner.ResumeLayout();
                    }
                }
            }
Пример #4
0
        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 = DEFAULT_GROUP_NAME, Dock = DockStyle.Top };
                Shell.Controls.Add(menuStrip);

                Initialize(container, menuStrip);

                // Add default buttons
                container.SuspendLayout();
                menuStrip.SuspendLayout();

                new DefaultMenuBars(App).Initialize(this);

                container.ResumeLayout();
                menuStrip.ResumeLayout();
            }
        }
            public void AddRange(ToolStripPanelRowCollection value)
            {
                if (value is null)
                {
                    throw new ArgumentNullException(nameof(value));
                }

                ToolStripPanel currentOwner = _owner;

                if (currentOwner != null)
                {
                    currentOwner.SuspendLayout();
                }

                try
                {
                    int currentCount = value.Count;
                    for (int i = 0; i < currentCount; i++)
                    {
                        Add(value[i]);
                    }
                }
                finally
                {
                    if (currentOwner != null)
                    {
                        currentOwner.ResumeLayout();
                    }
                }
            }
            public void AddRange(ToolStripPanel.ToolStripPanelRowCollection value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                ToolStripPanel owner = this.owner;

                if (owner != null)
                {
                    owner.SuspendLayout();
                }
                try
                {
                    int count = value.Count;
                    for (int i = 0; i < count; i++)
                    {
                        this.Add(value[i]);
                    }
                }
                finally
                {
                    if (owner != null)
                    {
                        owner.ResumeLayout();
                    }
                }
            }
            public void AddRange(ToolStripPanelRow[] value)
            {
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }
                ToolStripPanel owner = this.owner;

                if (owner != null)
                {
                    owner.SuspendLayout();
                }
                try
                {
                    for (int i = 0; i < value.Length; i++)
                    {
                        this.Add(value[i]);
                    }
                }
                finally
                {
                    if (owner != null)
                    {
                        owner.ResumeLayout();
                    }
                }
            }
Пример #8
0
 public virtual void Clear()
 {
     if (_owner != null)
     {
         _owner.SuspendLayout();
     }
     try
     {
         while (Count != 0)
         {
             RemoveAt(Count - 1);
         }
     }
     finally
     {
         if (_owner != null)
         {
             _owner.ResumeLayout();
         }
     }
 }
Пример #9
0
            public virtual void Clear()
            {
                if (_owner is not null)
                {
                    ToolStripPanel.SuspendLayout();
                }

                try
                {
                    while (Count != 0)
                    {
                        RemoveAt(Count - 1);
                    }
                }
                finally
                {
                    if (_owner is not null)
                    {
                        ToolStripPanel.ResumeLayout();
                    }
                }
            }
Пример #10
0
        public void InitializeToolstrips(SWF.ToolStripPanel toolStripPanel, SWF.ToolStrip menuStrip, SWF.ToolStrip[] toolStrips)
        {
            toolStripPanel.SuspendLayout();

            var location = new System.Drawing.Point();

            toolStripPanel.Controls.Clear();
            toolStripPanel.ResumeLayout(true);
            var renderer = toolStripPanel.Renderer;

            renderer = new ToolStripRenderer {
                ToolStripButtonCheckedColor = this.ToolStripItemSelectedColor
            };
            toolStripPanel.Renderer = renderer;
            Application.DoEvents();

            toolStripPanel.SuspendLayout();

            if (ToolStripBackground != null)
            {
                toolStripPanel.BackColor = ToolStripBackground.Value;
                menuStrip.BackColor      = ToolStripBackground.Value;
            }
            if (ToolStripForeground != null)
            {
                toolStripPanel.ForeColor = ToolStripForeground.Value;
                menuStrip.ForeColor      = ToolStripForeground.Value;
            }
            if (menuStrip != null)
            {
                menuStrip.Location = new System.Drawing.Point();
                // toolStripPanel.Controls.Add (menuStrip);
                location = menuStrip.Location + new System.Drawing.Size(0, menuStrip.Size.Height + 10);
            }

            toolStrips.ForEach(toolStrip => {
                toolStrip.SuspendLayout();
                toolStrip.Renderer = renderer;
                var border         = toolStrip.Items.Count;
                var size           = new System.Drawing.Size(4, toolStrip.Size.Height);
                var i = 0;
                toolStrip.Items.Cast <SWF.ToolStripItem> ().ForEach(s => {
                    size         = new System.Drawing.Size(size.Width + s.Bounds.Width + 3, size.Height);
                    s.MergeIndex = i++;
                });
                toolStrip.ResumeLayout(true);
                toolStrip.Size = size;
                if (ToolStripBackground != null)
                {
                    toolStrip.BackColor = ToolStripBackground.Value;
                }
                if (ToolStripForeground != null)
                {
                    toolStrip.ForeColor = ToolStripForeground.Value;
                }
            });

            bool stripIsOutside = false;

            toolStrips.ForEach(toolStrip => {
                toolStrip.Location = location;
                if (stripIsOutside || toolStrip.Bounds.Right > toolStripPanel.Bounds.Right)
                {
                    toolStrip.Size = new System.Drawing.Size(1, 1);
                    stripIsOutside = true;
                }
                location = new System.Drawing.Point(toolStrip.Bounds.Right + 1, toolStrip.Bounds.Top);
            });

            toolStripPanel.Controls.Add(menuStrip);
            toolStripPanel.Controls.AddRange(toolStrips);


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