Inheritance: ContainerControl, IArrangedElement, IComponent, IDisposable
Beispiel #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();
                    }
                }
            }
Beispiel #2
0
 public ToolStripContainer()
 {
     base.SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw, true);
     base.SuspendLayout();
     try
     {
         this.topPanel          = new ToolStripPanel(this);
         this.bottomPanel       = new ToolStripPanel(this);
         this.leftPanel         = new ToolStripPanel(this);
         this.rightPanel        = new ToolStripPanel(this);
         this.contentPanel      = new ToolStripContentPanel();
         this.contentPanel.Dock = DockStyle.Fill;
         this.topPanel.Dock     = DockStyle.Top;
         this.bottomPanel.Dock  = DockStyle.Bottom;
         this.rightPanel.Dock   = DockStyle.Right;
         this.leftPanel.Dock    = DockStyle.Left;
         ToolStripContainerTypedControlCollection controls = this.Controls as ToolStripContainerTypedControlCollection;
         if (controls != null)
         {
             controls.AddInternal(this.contentPanel);
             controls.AddInternal(this.leftPanel);
             controls.AddInternal(this.rightPanel);
             controls.AddInternal(this.topPanel);
             controls.AddInternal(this.bottomPanel);
         }
     }
     finally
     {
         base.ResumeLayout(true);
     }
 }
        public ToolStripContainer() {

            SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);

            SuspendLayout();
            try {
                // undone - smart demand creation
                topPanel = new ToolStripPanel(this);
                bottomPanel = new ToolStripPanel(this);
                leftPanel = new ToolStripPanel(this);
                rightPanel = new ToolStripPanel(this);
                contentPanel = new ToolStripContentPanel();
                contentPanel.Dock = DockStyle.Fill;
                topPanel.Dock = DockStyle.Top;
                bottomPanel.Dock = DockStyle.Bottom;
                rightPanel.Dock = DockStyle.Right;
                leftPanel.Dock = DockStyle.Left;

                ToolStripContainerTypedControlCollection controlCollection = this.Controls as ToolStripContainerTypedControlCollection;
                if (controlCollection != null) {
                    controlCollection.AddInternal(contentPanel);
                    controlCollection.AddInternal(leftPanel);
                    controlCollection.AddInternal(rightPanel);
                    controlCollection.AddInternal(topPanel);
                    controlCollection.AddInternal(bottomPanel);
                }
                // else consider throw new exception

            }
            finally {
                ResumeLayout(true);
            }
        }
Beispiel #4
0
 public ToolPanel()
 {
     mToolStrips = new List<ToolStrip>();
     mToolStripPanel = null;
     mDockStyle = @"None";
     mContain = null;
 }
Beispiel #5
0
            public SettingsStub(ToolStrip toolStrip)
            {
                this.ToolStripPanelName = string.Empty;
                ToolStripPanel parentPanel = toolStrip.Parent as ToolStripPanel;

                if (parentPanel != null)
                {
                    if (!string.IsNullOrEmpty(parentPanel.Name))
                    {
                        this.ToolStripPanelName = parentPanel.Name;
                    }
                    else if (parentPanel.Parent is ToolStripContainer && !string.IsNullOrEmpty(parentPanel.Parent.Name))
                    {
                        // Handle the case when the ToolStripPanel belongs to a ToolStripContainer.
                        this.ToolStripPanelName = parentPanel.Parent.Name + "." + parentPanel.Dock.ToString();
                    }

                    Debug.Assert(!string.IsNullOrEmpty(this.ToolStripPanelName), "ToolStrip was parented to a panel, but we couldn't figure out its name.");
                }

                this.Visible   = toolStrip.Visible;
                this.Size      = toolStrip.Size;
                this.Location  = toolStrip.Location;
                this.Name      = toolStrip.Name;
                this.ItemOrder = GetItemOrder(toolStrip);
            }
        public ToolStripContainer()
        {
            SetStyle(ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, true);

            SuspendLayout();
            try {
                // undone - smart demand creation
                topPanel          = new ToolStripPanel(this);
                bottomPanel       = new ToolStripPanel(this);
                leftPanel         = new ToolStripPanel(this);
                rightPanel        = new ToolStripPanel(this);
                contentPanel      = new ToolStripContentPanel();
                contentPanel.Dock = DockStyle.Fill;
                topPanel.Dock     = DockStyle.Top;
                bottomPanel.Dock  = DockStyle.Bottom;
                rightPanel.Dock   = DockStyle.Right;
                leftPanel.Dock    = DockStyle.Left;

                ToolStripContainerTypedControlCollection controlCollection = this.Controls as ToolStripContainerTypedControlCollection;
                if (controlCollection != null)
                {
                    controlCollection.AddInternal(contentPanel);
                    controlCollection.AddInternal(leftPanel);
                    controlCollection.AddInternal(rightPanel);
                    controlCollection.AddInternal(topPanel);
                    controlCollection.AddInternal(bottomPanel);
                }
                // else consider throw new exception
            }
            finally {
                ResumeLayout(true);
            }
        }
            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();
                    }
                }
            }
Beispiel #9
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();
                    }
                }
            }
		public ToolStripContainer () : base ()
		{
			SetStyle (ControlStyles.SupportsTransparentBackColor, true);
			SetStyle (ControlStyles.ResizeRedraw, true);

			content_panel = new ToolStripContentPanel ();
			content_panel.Dock = DockStyle.Fill;
			this.Controls.Add (content_panel);

			this.top_panel = new ToolStripPanel ();
			this.top_panel.Dock = DockStyle.Top;
			this.top_panel.Height = 0;
			this.Controls.Add (top_panel);

			this.bottom_panel = new ToolStripPanel ();
			this.bottom_panel.Dock = DockStyle.Bottom;
			this.bottom_panel.Height = 0;
			this.Controls.Add (bottom_panel);

			this.left_panel = new ToolStripPanel ();
			this.left_panel.Dock = DockStyle.Left;
			this.left_panel.Width = 0;
			this.Controls.Add (left_panel);

			this.right_panel = new ToolStripPanel ();
			this.right_panel.Dock = DockStyle.Right;
			this.right_panel.Width = 0;
			this.Controls.Add (right_panel);
	}
Beispiel #11
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(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();
                    }
                }
            }
            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();
                    }
                }
            }
Beispiel #14
0
        public ToolStripContainer() : base()
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.ResizeRedraw, true);

            content_panel      = new ToolStripContentPanel();
            content_panel.Dock = DockStyle.Fill;
            this.Controls.Add(content_panel);

            this.top_panel        = new ToolStripPanel();
            this.top_panel.Dock   = DockStyle.Top;
            this.top_panel.Height = 0;
            this.Controls.Add(top_panel);

            this.bottom_panel        = new ToolStripPanel();
            this.bottom_panel.Dock   = DockStyle.Bottom;
            this.bottom_panel.Height = 0;
            this.Controls.Add(bottom_panel);

            this.left_panel       = new ToolStripPanel();
            this.left_panel.Dock  = DockStyle.Left;
            this.left_panel.Width = 0;
            this.Controls.Add(left_panel);

            this.right_panel       = new ToolStripPanel();
            this.right_panel.Dock  = DockStyle.Right;
            this.right_panel.Width = 0;
            this.Controls.Add(right_panel);
        }
 public ToolStripPanelRow(ToolStripPanel parent)
 {
     this.bounds        = Rectangle_.Empty;
     this.controls      = new List <Control> ();
     this.layout_engine = new DefaultLayout();
     this.parent        = parent;
 }
		public ToolStripPanelRow (ToolStripPanel parent)
		{
			this.bounds = Rectangle.Empty;
			this.controls = new List<Control> ();
			this.layout_engine = new DefaultLayout ();
			this.parent = parent;
		}
Beispiel #17
0
        public static void Load( IPluginHost host, ToolStripPanel panel, ToolStripMenuItem pluginMenu )
        {
            PluginHost = host;
            Program.LoadedPlugins.Clear ( );
            var asm = typeof ( PluginLoader ).Assembly;

            var plugins = Settings.Instance.PluginSettings.GetPlugins ( host );
            var rows = panel.Rows.Length;
            foreach ( IPlugin plugin in plugins ) {
                var pluginInfo = Settings.Instance.PluginSettings.GetPluginInfo ( plugin );
                if ( pluginInfo.Enabled ) {
                    pluginInfo.LogDebug ( "Loading: {0}", pluginInfo.Name );
                    Program.LoadedPlugins.Add ( plugin );

                    plugin.Initialize ( host );

                    if ( !plugin.CreateToolButton ) {
                        continue;
                    }
                    var tsb = plugin.CreateToolStripButton ( );
                    var tsm = plugin.CreateToolStripMenuItem ( );
                    var group = plugin.Group.Or ( "[DEFAULT]" );

                    var added = false;
                    foreach ( var c in panel.Controls ) {
                        if ( c.Is<ToolStrip> ( ) && string.Compare ( ( (ToolStrip)c ).Name, group, true ) == 0 ) {
                            ( (ToolStrip)c ).Items.Add ( tsb );
                            added = true;
                            break;
                        }
                    }
                    if ( !added ) {
                        // need to create the toolstrip and add the item
                        var strip = new ToolStrip ( tsb ) {
                            Name = group,
                        };
                        panel.Join ( strip, rows );
                    }

                    // menu items
                    var parentMenu = default ( ToolStripMenuItem );
                    foreach ( ToolStripMenuItem mi in pluginMenu.DropDownItems ) {
                        if ( mi.Text == group ) {
                            parentMenu = (ToolStripMenuItem)mi;
                        }
                    }
                    if ( parentMenu == null ) {
                        parentMenu = new ToolStripMenuItem ( group );
                        pluginMenu.DropDownItems.Add ( parentMenu );
                    }

                    parentMenu.DropDownItems.Add ( tsm );

                    if ( pluginInfo.ExecuteOnLoad && pluginInfo.Enabled ) {
                        plugin.Execute ( host );
                    }
                }
            }
        }
 protected override void InitializePanel(System.Windows.Forms.ToolStripPanel toolStripPanel)
 {
     base.InitializePanel(toolStripPanel);
     if (!this.m_ToolStripPanels.Contains(toolStripPanel))
     {
         this.m_ToolStripPanels.Add(toolStripPanel);
     }
     PostInitialize();
 }
        public NativeToolStripRenderer(ToolStripPanel panel, ToolbarTheme theme)
        {
            if (panel == null)
                throw new ArgumentNullException("panel", "Panel cannot be null.");

            Theme = theme;

            this.toolStrip = null;
            defaultRenderer = panel.Renderer;
        }
Beispiel #20
0
 public ToolStripPanelRowCollection(ToolStripPanel owner, ToolStripPanelRow[] value) : this(owner)
 {
     if (value != null)
     {
         foreach (ToolStripPanelRow tspr in value)
         {
             this.Add(tspr);
         }
     }
 }
 internal ToolStripPanelSelectionGlyph(Rectangle bounds, Cursor cursor, IComponent relatedComponent, IServiceProvider provider, ToolStripPanelSelectionBehavior behavior) : base(bounds, cursor, relatedComponent, behavior)
 {
     this.relatedBehavior = behavior;
     this.provider = provider;
     this.relatedPanel = relatedComponent as ToolStripPanel;
     this.behaviorService = (BehaviorService) provider.GetService(typeof(BehaviorService));
     if ((this.behaviorService != null) && (((IDesignerHost) provider.GetService(typeof(IDesignerHost))) != null))
     {
         this.UpdateGlyph();
     }
 }
Beispiel #22
0
 public static void SetProcessMenu(UserControl tmpUI, ref ToolStripPanel tmpPanel)
 {
     foreach (QProcess proc in Global.Processes)
         if (proc.UI.Tag == tmpUI.Tag)
         {
             foreach (ToolStrip tmpStrip in tmpPanel.Controls)
                 if (tmpStrip.Tag != proc.Menu.Tag)
                     tmpPanel.Controls.Remove(tmpStrip);
             tmpPanel.Controls.Add(proc.Menu);
         }
 }
        private void SaveToolStripPanel(ToolStripPanel panel, string position,
                                        ToolStripSettingElementCollection newSettings)
        {
            int rowIndex = 0;

            foreach (ToolStripPanelRow row in panel.Rows)
            {
                this.SaveToolStripRow(row, newSettings, position, rowIndex);
                rowIndex++;
            }
        }
		public void PropertyDock ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.Dock = DockStyle.Left;
			Assert.AreEqual (DockStyle.Left, tsp.Dock, "B1");
			Assert.AreEqual (string.Empty, ew.ToString (), "B2");

			ew.Clear ();
			tsp.Dock = DockStyle.Left;
			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
		public void PropertyAutoSize ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.AutoSize = false;
			Assert.AreEqual (false, tsp.AutoSize, "B1");
			Assert.AreEqual ("AutoSizeChanged", ew.ToString (), "B2");

			ew.Clear ();
			tsp.AutoSize = false;
			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
Beispiel #26
0
        public static void ProcessConfigItem(WorkItem workItem, ToolStripPanel toolStripPanel, MenuItemElement menuItem)
        {
            if (menuItem.IsContainer)
            {

                ToolStrip toolStrip = menuItem.ToToolStrip();

                toolStrip.Size = new System.Drawing.Size(442, 25);
                toolStrip.Text = menuItem.Site;
                toolStrip.Name = menuItem.Site;
                toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32);
                toolStripPanel.Join(toolStrip);

                workItem.UIExtensionSites.RegisterSite(menuItem.Site, toolStrip);

                workItem.RootWorkItem.Items.Add(toolStrip, menuItem.Site);
            }
            else
            {

                foreach (Control control in toolStripPanel.Controls)
                {

                    ToolStrip toolStrip = control as ToolStrip;
                    toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32);

                    if (toolStrip != null)
                    {

                        if (toolStrip.Name == menuItem.Site)
                        {

                            ToolStripButton toolStripButton = menuItem.ToToolStripItem();
                            toolStripButton.ToolTipText = menuItem.CommandName;
                            toolStripButton.Name = menuItem.CommandName;
                            toolStripButton.Tag = menuItem.Icon;
                            toolStripButton.Image = menuItem.GetIcon(menuItem.Icon);
                            if (workItem.UIExtensionSites.Contains(menuItem.Site))
                            {

                                workItem.UIExtensionSites[menuItem.Site].Add<ToolStripButton>(toolStripButton);
                            }

                            if (!String.IsNullOrEmpty(menuItem.CommandName))
                                workItem.Commands[menuItem.CommandName].AddInvoker(toolStripButton, "Click");

                        }
                    }
                }
            }
        }
		public void Constructor ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();

			Assert.AreEqual (true, tsp.AutoSize, "A1");
			Assert.AreEqual (DockStyle.None, tsp.Dock, "A2");
			Assert.AreEqual ("System.Windows.Forms.Layout.FlowLayout", tsp.LayoutEngine.ToString (), "A3");
			Assert.AreEqual (false, tsp.Locked, "A4");
			Assert.AreEqual (Orientation.Horizontal, tsp.Orientation, "A5");
			Assert.AreSame (ToolStripManager.Renderer, tsp.Renderer, "A6");
			Assert.AreEqual (ToolStripRenderMode.ManagerRenderMode, tsp.RenderMode, "A7");
			Assert.AreEqual (new Padding (3, 0, 0, 0), tsp.RowMargin, "A8");
			Assert.AreEqual ("System.Windows.Forms.ToolStripPanelRow[]", tsp.Rows.ToString (), "A9");
		}
 protected override void OnMouseUp(MouseEventArgs mea)
 {
     if (this.MovingToolStrip)
     {
         Point screenLocation = base.TranslatePoint(new Point(mea.X, mea.Y), ToolStripPointType.ToolStripItemCoords, ToolStripPointType.ScreenCoords);
         this.ToolStripPanelRow.ToolStripPanel.MoveControl(base.ParentInternal, screenLocation);
     }
     if (!base.ParentInternal.IsInDesignMode)
     {
         SetCursor(base.ParentInternal, this.oldCursor);
     }
     ToolStripPanel.ClearDragFeedback();
     this.MovingToolStrip = false;
     base.OnMouseUp(mea);
 }
Beispiel #29
0
 private void Frm_Main_Load(object sender, EventArgs e)
 {
     ToolStripPanel tsp_Top = new ToolStripPanel();//创建ToolStripPanel对象
     ToolStripPanel tsp_Bottom = new ToolStripPanel();//创建ToolStripPanel对象
     ToolStripPanel tsp_Left = new ToolStripPanel();//创建ToolStripPanel对象
     ToolStripPanel tsp_right = new ToolStripPanel();//创建ToolStripPanel对象
     tsp_Top.Dock = DockStyle.Top;//设置停靠方式
     tsp_Bottom.Dock = DockStyle.Bottom;//设置停靠方式
     tsp_Left.Dock = DockStyle.Left;//设置停靠方式
     tsp_right.Dock = DockStyle.Right;//设置停靠方式
     Controls.Add(tsp_Top);//添加到控件集合
     Controls.Add(tsp_Bottom);//添加到控件集合
     Controls.Add(tsp_Left);//添加到控件集合
     Controls.Add(tsp_right);//添加到控件集合
     tsp_Bottom.Join(toolStrip1);//将指定的工具栏添加到面板
 }
Beispiel #30
0
        protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs mea)
        {
            if (MovingToolStrip)
            {
                Point endLocation = TranslatePoint(new Point(mea.X, mea.Y), ToolStripPointType.ToolStripItemCoords, ToolStripPointType.ScreenCoords);
                ToolStripPanelRow.ToolStripPanel.MoveControl(ParentInternal, /*startLocation,*/ endLocation);
            }

            if (!ParentInternal.IsInDesignMode)
            {
                SetCursor(ParentInternal, oldCursor);
            }
            ToolStripPanel.ClearDragFeedback();
            MovingToolStrip = false;
            base.OnMouseUp(mea);
        }
        private void MoveOutsideContainer(ToolStrip toolStripToDrag, Point screenLocation)
        {
            ToolStripPanel controlToLayout = ToolStripManager.ToolStripPanelFromPoint(toolStripToDrag, screenLocation);

            if (controlToLayout != null)
            {
                using (new LayoutTransaction(controlToLayout, controlToLayout, null))
                {
                    controlToLayout.MoveControl(toolStripToDrag, screenLocation);
                }
                toolStripToDrag.PerformLayout();
            }
            else
            {
                this.GiveToolStripPanelFeedback(toolStripToDrag, screenLocation);
            }
        }
Beispiel #32
0
        /// <summary>
        /// AddToolbar调用,获取最后一个toolstrip的位置,以便确定新的toolstrip的位置
        /// </summary>
        private System.Drawing.Point GetLastLocationOnToolStrip(System.Windows.Forms.ToolStripPanel myToolstripPanel)
        {
            int x_end = 3;
            int y     = 3;

            foreach (Control myControl in myToolstripPanel.Controls)
            {
                if (!(myControl is ToolStrip))
                {
                    continue;
                }

                ToolStrip myToolstrip = myControl as ToolStrip;
                if (myToolstrip == null)
                {
                    continue;
                }
                if (myToolstrip.Name == "MenuStrip1")
                {
                    continue;
                }

                if (!m_CustomToolbars.ContainsKey(myToolstrip.Name))//将系统自带的工具条对象添加到m_CustomToolbars中
                {
                    m_CustomToolbars.Add(myToolstrip.Name, myToolstrip);
                }

                // Get the highest values:
                if (myToolstrip.Location.X + myToolstrip.Width > x_end && myToolstrip.Location.Y >= y)
                {
                    x_end = myToolstrip.Location.X + myToolstrip.Width;
                }

                if (myToolstrip.Location.Y > y)
                {
                    //Next row:
                    x_end = myToolstrip.Location.X + myToolstrip.Width;
                    y     = myToolstrip.Location.Y;
                }
            }

            return(new System.Drawing.Point(x_end, y));
        }
Beispiel #33
0
 private void InitializeComponent()
 {
     this.msMain    = new System.Windows.Forms.MenuStrip();
     this.pToolBars = new System.Windows.Forms.ToolStripPanel();
     this.SuspendLayout();
     //
     // il
     //
     this.il.ColorDepth = System.Windows.Forms.ColorDepth.Depth24Bit;
     //
     // msMain
     //
     this.msMain.AllowMerge       = false;
     this.msMain.ImageList        = this.il;
     this.msMain.Location         = new System.Drawing.Point(0, 0);
     this.msMain.Name             = "msMain";
     this.msMain.ShowItemToolTips = true;
     this.msMain.Size             = new System.Drawing.Size(550, 24);
     this.msMain.TabIndex         = 0;
     this.msMain.Text             = "menuStrip1";
     //
     // pToolbars
     //
     this.pToolBars.Dock        = System.Windows.Forms.DockStyle.Top;
     this.pToolBars.Location    = new System.Drawing.Point(0, 24);
     this.pToolBars.Name        = "pToolbars";
     this.pToolBars.Orientation = System.Windows.Forms.Orientation.Horizontal;
     this.pToolBars.RowMargin   = new System.Windows.Forms.Padding(3, 0, 0, 0);
     this.pToolBars.Size        = new System.Drawing.Size(550, 0);
     //
     // BaseGuiForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(550, 549);
     this.Controls.Add(this.pToolBars);
     this.Controls.Add(this.msMain);
     this.MainMenuStrip = this.msMain;
     this.Name          = "BaseGuiForm";
     this.Text          = "BaseGUIForm";
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Beispiel #34
0
 public override void _initControl()
 {
     if (null == mToolStripPanel || mToolStripPanel.IsDisposed)
     {
         mToolStripPanel = new ToolStripPanel();
         if (string.Compare(mDockStyle, @"Top") == 0)
         {
             mToolStripPanel.Dock = DockStyle.Top;
         }
         else if (string.Compare(mDockStyle, @"Bottom") == 0)
         {
             mToolStripPanel.Dock = DockStyle.Bottom;
         }
         else if (string.Compare(mDockStyle, @"Fill") == 0)
         {
             mToolStripPanel.Dock = DockStyle.Fill;
         }
         else if (string.Compare(mDockStyle, @"Left") == 0)
         {
             mToolStripPanel.Dock = DockStyle.Left;
         }
         else if (string.Compare(mDockStyle, @"Right") == 0)
         {
             mToolStripPanel.Dock = DockStyle.Right;
         }
         else
         {
             mToolStripPanel.Dock = DockStyle.None;
         }
     }
     foreach (ToolStrip i in mToolStrips)
     {
         i._initControl();
     }
     foreach (ToolStrip i in mToolStrips)
     {
         System.Windows.Forms.ToolStrip toolStrip_ = i._getToolStrip();
         mToolStripPanel.Controls.Add(toolStrip_);
     }
 }
Beispiel #35
0
            public SettingsStub(ToolStrip toolStrip)
            {
                this.ToolStripPanelName = string.Empty;
                ToolStripPanel parent = toolStrip.Parent as ToolStripPanel;

                if (parent != null)
                {
                    if (!string.IsNullOrEmpty(parent.Name))
                    {
                        this.ToolStripPanelName = parent.Name;
                    }
                    else if ((parent.Parent is ToolStripContainer) && !string.IsNullOrEmpty(parent.Parent.Name))
                    {
                        this.ToolStripPanelName = parent.Parent.Name + "." + parent.Dock.ToString();
                    }
                }
                this.Visible   = toolStrip.Visible;
                this.Size      = toolStrip.Size;
                this.Location  = toolStrip.Location;
                this.Name      = toolStrip.Name;
                this.ItemOrder = ToolStripSettingsManager.GetItemOrder(toolStrip);
            }
Beispiel #36
0
        internal ToolStripPanelRow(ToolStripPanel parent, bool visible)
        {
#if DEBUG
            _thisRowID = ++s_rowCreationCount;
#endif
            if (DpiHelper.IsScalingRequirementMet)
            {
                _minAllowedWidth = DpiHelper.LogicalToDeviceUnitsX(MinAllowedWidth);
            }

            this.ToolStripPanel    = parent;
            _state[s_stateVisible] = visible;
            _state[s_stateDisposing | s_stateLocked | s_stateInitialized] = false;

            Debug.WriteLineIf(s_toolStripPanelRowCreationDebug.TraceVerbose, "Created new ToolStripPanelRow");

            using (LayoutTransaction lt = new LayoutTransaction(parent, this, null))
            {
                Margin = DefaultMargin;
                CommonProperties.SetAutoSize(this, true);
            }
        }
Beispiel #37
0
        public static void LoadFromConfig(WorkItem workItem, ToolStripPanel toolStripPanel, XmlDocument doc)
        {
            XmlConfig xcfg = new XmlConfig(doc);

            ConfigSetting newplugin = xcfg.Settings["toolstrips"];

            foreach (ConfigSetting setting in newplugin.Children())
            {
                if (setting.Name.Contains("comment"))
                    continue;
                MenuItemElement menuItem = new MenuItemElement();

                menuItem.CommandName = setting["commandname"].Value;
                menuItem.Icon = setting["icon"].Value;
                menuItem.Label = setting["label"].Value;
                menuItem.ID = setting["id"].Value == "" ? 0 : Convert.ToInt32(setting["id"].Value);
                menuItem.Key = setting["key"].Value;
                menuItem.IsContainer = setting["iscontainer"].Value == "" ? false : true;
                menuItem.Site = setting["site"].Value;

                ProcessConfigItem(workItem, toolStripPanel, menuItem);
            }
        }
Beispiel #38
0
 /// <summary>
 /// Initializes the form components
 /// </summary>
 private void InitializeComponents()
 {
     this.quickFind = new QuickFind();
     this.dockPanel = new DockPanel();
     this.statusStrip = new StatusStrip();
     this.toolStripPanel = new ToolStripPanel();
     this.menuStrip = StripBarManager.GetMenuStrip(FileNameHelper.MainMenu);
     this.toolStrip = StripBarManager.GetToolStrip(FileNameHelper.ToolBar);
     this.editorMenu = StripBarManager.GetContextMenu(FileNameHelper.ScintillaMenu);
     this.tabMenu = StripBarManager.GetContextMenu(FileNameHelper.TabMenu);
     this.toolStripStatusLabel = new ToolStripStatusLabel();
     this.toolStripProgressLabel = new ToolStripStatusLabel();
     this.toolStripProgressBar = new ToolStripProgressBar();
     this.printPreviewDialog = new PrintPreviewDialog();
     this.saveFileDialog = new SaveFileDialog();
     this.openFileDialog = new OpenFileDialog();
     this.colorDialog = new ColorDialog();
     this.printDialog = new PrintDialog();
     this.SuspendLayout();
     //
     // toolStripPanel
     //
     this.toolStripPanel.Dock = DockStyle.Top;
     this.toolStripPanel.Controls.Add(this.toolStrip);
     this.toolStripPanel.Controls.Add(this.menuStrip);
     this.tabMenu.Font = Globals.Settings.DefaultFont;
     this.toolStrip.Font = Globals.Settings.DefaultFont;
     this.menuStrip.Font = Globals.Settings.DefaultFont;
     this.editorMenu.Font = Globals.Settings.DefaultFont;
     this.toolStrip.Renderer = new DockPanelStripRenderer(false);
     this.toolStrip.Padding = new Padding(0, 1, 0, 0);
     this.toolStrip.Size = new Size(500, 26);
     this.toolStrip.Stretch = true;
     // 
     // openFileDialog
     //
     this.openFileDialog.Title = " " + TextHelper.GetString("Title.OpenFileDialog");
     this.openFileDialog.Filter = TextHelper.GetString("Info.FileDialogFilter") + "|*.*";
     this.openFileDialog.RestoreDirectory = true;
     //
     // colorDialog
     //
     this.colorDialog.FullOpen = true;
     this.colorDialog.ShowHelp = false;
     // 
     // printPreviewDialog
     //
     this.printPreviewDialog.Enabled = true;
     this.printPreviewDialog.Name = "printPreviewDialog";
     this.printPreviewDialog.StartPosition = FormStartPosition.CenterParent;
     this.printPreviewDialog.TransparencyKey = Color.Empty;
     this.printPreviewDialog.Visible = false;
     // 
     // saveFileDialog
     //
     this.saveFileDialog.Title = " " + TextHelper.GetString("Title.SaveFileDialog");
     this.saveFileDialog.Filter = TextHelper.GetString("Info.FileDialogFilter") + "|*.*";
     this.saveFileDialog.RestoreDirectory = true;
     // 
     // dockPanel
     //
     this.dockPanel.TabIndex = 2;
     this.dockPanel.DocumentStyle = DocumentStyle.DockingWindow;
     this.dockPanel.DockWindows[DockState.Document].Controls.Add(this.quickFind);
     this.dockPanel.Dock = DockStyle.Fill;
     this.dockPanel.Name = "dockPanel";
     //
     // toolStripStatusLabel
     //
     this.toolStripStatusLabel.Name = "toolStripStatusLabel";
     this.toolStripStatusLabel.TextAlign = ContentAlignment.MiddleLeft;
     this.toolStripStatusLabel.Spring = true;
     //
     // toolStripProgressLabel
     //
     this.toolStripProgressLabel.AutoSize = true;
     this.toolStripProgressLabel.Name = "toolStripProgressLabel";
     this.toolStripProgressLabel.TextAlign = ContentAlignment.MiddleRight;
     this.toolStripProgressLabel.Visible = false;
     //
     // toolStripProgressBar
     //
     this.toolStripProgressBar.Name = "toolStripProgressBar";
     this.toolStripProgressBar.ControlAlign = ContentAlignment.MiddleRight;
     this.toolStripProgressBar.ProgressBar.Width = 120;
     this.toolStripProgressBar.Visible = false;
     // 
     // statusStrip
     //
     this.statusStrip.TabIndex = 3;
     this.statusStrip.Name = "statusStrip";
     this.statusStrip.Items.Add(this.toolStripStatusLabel);
     this.statusStrip.Items.Add(this.toolStripProgressLabel);
     this.statusStrip.Items.Add(this.toolStripProgressBar);
     this.statusStrip.Font = Globals.Settings.DefaultFont;
     this.statusStrip.Stretch = true;
     // 
     // MainForm
     //
     this.AllowDrop = true;
     this.Name = "MainForm";
     this.Text = "FlashDevelop";
     this.Size = new Size(500, 350);
     this.Controls.Add(this.dockPanel);
     this.Controls.Add(this.toolStripPanel);
     this.Controls.Add(this.statusStrip);
     this.MainMenuStrip = this.menuStrip;
     this.Size = this.appSettings.WindowSize;
     this.Font = this.appSettings.DefaultFont;
     this.StartPosition = FormStartPosition.Manual;
     this.Closing += new CancelEventHandler(this.OnMainFormClosing);
     this.Activated += new EventHandler(this.OnMainFormActivate);
     this.Shown += new EventHandler(this.OnMainFormShow);
     this.Load += new EventHandler(this.OnMainFormLoad);
     this.LocationChanged += new EventHandler(this.OnMainFormLocationChange);
     this.GotFocus += new EventHandler(this.OnMainFormGotFocus);
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Beispiel #39
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a ToolStripContainer control.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void InitToolStripContainer(Form parentForm, Control contentControl)
		{
			m_tsContainer = contentControl as ToolStripContainer;
			if (m_tsContainer != null)
				return;

			if (contentControl == null)
			{
				m_tsPanel = new ToolStripPanel();
				m_tsPanel.Dock = DockStyle.Top;
				parentForm.Controls.Add(m_tsPanel);
			}
			else
			{
				m_tsContainer = new ToolStripContainer();
				m_tsContainer.Dock = DockStyle.Fill;
				parentForm.Controls.Remove(contentControl);
				m_tsContainer.ContentPanel.Controls.Add(contentControl);
				parentForm.Controls.Add(m_tsContainer);
			}
		}
			public EventWatcher (ToolStripPanel tsp)
			{
				tsp.AutoSizeChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("AutoSizeChanged;"); });
				tsp.RendererChanged += new EventHandler (delegate (Object obj, EventArgs e) { events += ("RendererChanged;"); });
			}
        /// <summary>
        /// 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.
        /// </summary>
        protected override void InitializePanel(ToolStripPanel toolStripPanel)
        {
            foreach (Control control in toolStripPanel.Controls)
                if (control is ToolStrip)
                    Initialize((ToolStrip) control);

            base.InitializePanel(toolStripPanel);
        }
        public void TestBindingToToolStripPanel()
        {
            ToolStripPanel control = new ToolStripPanel();
            IBusinessObject obj = new BusinessObject();

            using(BindingScope scope = new BindingScope())
            {
                IBusinessObject bindableSource = scope.CreateSource(obj);

                if(control is Control)
                    ((Control)control).CreateControl();
                control.BindingContext = new BindingContext();

                ToolStripPanel bindableTarget = scope.CreateTarget(control);
                int dataBindingsBeforeTabIndex = control.DataBindings.Count;

                scope.Bind(bindableSource.IntValue).To(bindableTarget.TabIndex);

                Assert.AreEqual(dataBindingsBeforeTabIndex + 1, control.DataBindings.Count);

                Assert.AreEqual(control.TabIndex, obj.IntValue);

                obj.ChangeIntValue();

                Assert.AreEqual(control.TabIndex, obj.IntValue);

                int dataBindingsBeforeText = control.DataBindings.Count;

                scope.Bind(bindableSource.Name).To(bindableTarget.Text);

                Assert.AreEqual(dataBindingsBeforeText + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Text, obj.Name);

                obj.ChangeName();

                Assert.AreEqual(control.Text, obj.Name);

                int dataBindingsBeforeAccessibleDefaultActionDescription = control.DataBindings.Count;

                scope.Bind(bindableSource.Name).To(bindableTarget.AccessibleDefaultActionDescription);

                Assert.AreEqual(dataBindingsBeforeAccessibleDefaultActionDescription + 1, control.DataBindings.Count);

                Assert.AreEqual(control.AccessibleDefaultActionDescription, obj.Name);

                obj.ChangeName();

                Assert.AreEqual(control.AccessibleDefaultActionDescription, obj.Name);

                int dataBindingsBeforeAccessibleDescription = control.DataBindings.Count;

                scope.Bind(bindableSource.Name).To(bindableTarget.AccessibleDescription);

                Assert.AreEqual(dataBindingsBeforeAccessibleDescription + 1, control.DataBindings.Count);

                Assert.AreEqual(control.AccessibleDescription, obj.Name);

                obj.ChangeName();

                Assert.AreEqual(control.AccessibleDescription, obj.Name);

                int dataBindingsBeforeAccessibleName = control.DataBindings.Count;

                scope.Bind(bindableSource.Name).To(bindableTarget.AccessibleName);

                Assert.AreEqual(dataBindingsBeforeAccessibleName + 1, control.DataBindings.Count);

                Assert.AreEqual(control.AccessibleName, obj.Name);

                obj.ChangeName();

                Assert.AreEqual(control.AccessibleName, obj.Name);

                int dataBindingsBeforeHeight = control.DataBindings.Count;

                scope.Bind(bindableSource.IntValue).To(bindableTarget.Height);

                Assert.AreEqual(dataBindingsBeforeHeight + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Height, obj.IntValue);

                obj.ChangeIntValue();

                Assert.AreEqual(control.Height, obj.IntValue);

                int dataBindingsBeforeLeft = control.DataBindings.Count;

                scope.Bind(bindableSource.IntValue).To(bindableTarget.Left);

                Assert.AreEqual(dataBindingsBeforeLeft + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Left, obj.IntValue);

                obj.ChangeIntValue();

                Assert.AreEqual(control.Left, obj.IntValue);

                int dataBindingsBeforeName = control.DataBindings.Count;

                scope.Bind(bindableSource.Name).To(bindableTarget.Name);

                Assert.AreEqual(dataBindingsBeforeName + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Name, obj.Name);

                obj.ChangeName();

                Assert.AreEqual(control.Name, obj.Name);

                int dataBindingsBeforeTop = control.DataBindings.Count;

                scope.Bind(bindableSource.IntValue).To(bindableTarget.Top);

                Assert.AreEqual(dataBindingsBeforeTop + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Top, obj.IntValue);

                obj.ChangeIntValue();

                Assert.AreEqual(control.Top, obj.IntValue);

                int dataBindingsBeforeWidth = control.DataBindings.Count;

                scope.Bind(bindableSource.IntValue).To(bindableTarget.Width);

                Assert.AreEqual(dataBindingsBeforeWidth + 1, control.DataBindings.Count);

                Assert.AreEqual(control.Width, obj.IntValue);

                obj.ChangeIntValue();

                Assert.AreEqual(control.Width, obj.IntValue);

            }
        }
 /// <summary>
 ///  This class represents all the information to render the toolStrip
 /// </summary>
 public ToolStripPanelRenderEventArgs(Graphics g, ToolStripPanel toolStripPanel)
 {
     Graphics       = g;
     ToolStripPanel = toolStripPanel;
 }
		public void PropertyOrientation ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.Orientation = Orientation.Vertical;
			Assert.AreEqual (Orientation.Vertical, tsp.Orientation, "B1");
			Assert.AreEqual (string.Empty, ew.ToString (), "B2");

			ew.Clear ();
			tsp.Orientation = Orientation.Vertical;
			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
Beispiel #45
0
 public ToolStripPanelRowCollection(ToolStripPanel owner)
 {
     _owner = owner;
 }
Beispiel #46
0
 public ToolStripPanelRow(ToolStripPanel parent) : this(parent, true)
 {
 }
Beispiel #47
0
            //private ToolStripPanel owner;

            public ToolStripPanelRowCollection(ToolStripPanel owner) : base()
            {
                //this.owner = owner;
            }
		public ToolStripPanelRenderEventArgs (Graphics g, ToolStripPanel toolStripPanel)
		{
			this.graphics = g;
			this.tool_strip_panel = toolStripPanel;
			this.handled = false;
		}
Beispiel #49
0
 private void InitializeComponent()
 {
     this.SuspendLayout();
     this.mainMenu = new PdnMainMenu();
     this.toolStripPanel = new ToolStripPanel();
     this.commonActionsStrip = new CommonActionsStrip();
     this.viewConfigStrip = new ViewConfigStrip();
     this.toolChooserStrip = new ToolChooserStrip();
     this.toolConfigStrip = new ToolConfigStrip();
     this.documentStrip = new OurDocumentStrip();
     this.documentListButton = new ArrowButton();
     this.imageListMenu = new ImageListMenu();
     this.toolStripPanel.BeginInit();
     this.toolStripPanel.SuspendLayout();
     //
     // mainMenu
     //
     this.mainMenu.Name = "mainMenu";
     //
     // toolStripContainer
     //
     this.toolStripPanel.AutoSize = true;
     this.toolStripPanel.Name = "toolStripPanel";
     this.toolStripPanel.TabIndex = 0;
     this.toolStripPanel.TabStop = false;
     this.toolStripPanel.Join(this.viewConfigStrip);
     this.toolStripPanel.Join(this.commonActionsStrip);
     this.toolStripPanel.Join(this.toolConfigStrip);
     this.toolStripPanel.Join(this.toolChooserStrip);
     //
     // commonActionsStrip
     //
     this.commonActionsStrip.Name = "commonActionsStrip";
     this.commonActionsStrip.AutoSize = false;
     this.commonActionsStrip.TabIndex = 0;
     this.commonActionsStrip.Dock = DockStyle.None;
     this.commonActionsStrip.GripStyle = toolStripsGripStyle;
     //
     // viewConfigStrip
     //
     this.viewConfigStrip.Name = "viewConfigStrip";
     this.viewConfigStrip.AutoSize = false;
     this.viewConfigStrip.ZoomBasis = PaintDotNet.ZoomBasis.FitToWindow;
     this.viewConfigStrip.TabStop = false;
     this.viewConfigStrip.DrawGrid = false;
     this.viewConfigStrip.TabIndex = 1;
     this.viewConfigStrip.Dock = DockStyle.None;
     this.viewConfigStrip.GripStyle = toolStripsGripStyle;
     //
     // toolChooserStrip
     //
     this.toolChooserStrip.Name = "toolChooserStrip";
     this.toolChooserStrip.AutoSize = false;
     this.toolChooserStrip.TabIndex = 2;
     this.toolChooserStrip.Dock = DockStyle.None;
     this.toolChooserStrip.GripStyle = toolStripsGripStyle;
     this.toolChooserStrip.ChooseDefaultsClicked += new EventHandler(ToolChooserStrip_ChooseDefaultsClicked);
     //
     // toolConfigStrip
     //
     this.toolConfigStrip.Name = "drawConfigStrip";
     this.toolConfigStrip.AutoSize = false;
     this.toolConfigStrip.ShapeDrawType = PaintDotNet.ShapeDrawType.Outline;
     this.toolConfigStrip.TabIndex = 3;
     this.toolConfigStrip.Dock = DockStyle.None;
     this.toolConfigStrip.GripStyle = toolStripsGripStyle;
     this.toolConfigStrip.Layout +=
         delegate(object sender, LayoutEventArgs e)
         {
             PerformLayout();
         };
     //
     // documentStrip
     //
     this.documentStrip.AutoSize = false;
     this.documentStrip.Name = "documentStrip";
     this.documentStrip.TabIndex = 5;
     this.documentStrip.ShowScrollButtons = true;
     this.documentStrip.DocumentListChanged += new EventHandler(DocumentStrip_DocumentListChanged);
     this.documentStrip.DocumentClicked += new EventHandler<Pair<DocumentWorkspace, DocumentClickAction>>(DocumentStrip_DocumentClicked);
     this.documentStrip.ManagedFocus = true;
     //
     // documentListButton
     //
     this.documentListButton.Name = "documentListButton";
     this.documentListButton.ArrowDirection = ArrowDirection.Down;
     this.documentListButton.ReverseArrowColors = true;
     this.documentListButton.Click += new EventHandler(DocumentListButton_Click);
     //
     // imageListMenu
     //
     this.imageListMenu.Name = "imageListMenu";
     this.imageListMenu.Closed += new EventHandler(ImageListMenu_Closed);
     this.imageListMenu.ItemClicked += new EventHandler<ImageListMenu.Item>(ImageListMenu_ItemClicked);
     //
     // PdnToolBar
     //
     this.Controls.Add(this.documentListButton);
     this.Controls.Add(this.documentStrip);
     this.Controls.Add(this.toolStripPanel);
     this.Controls.Add(this.mainMenu);
     this.Controls.Add(this.imageListMenu);
     this.toolStripPanel.ResumeLayout(false);
     this.toolStripPanel.EndInit();
     this.ResumeLayout(false);
 }
Beispiel #50
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();
        }
		public void PropertyLocked ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.Locked = true;
			Assert.AreEqual (true, tsp.Locked, "B1");
			Assert.AreEqual (string.Empty, ew.ToString (), "B2");

			ew.Clear ();
			tsp.Locked = true;
			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
		public void PropertyRenderer ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			ToolStripProfessionalRenderer pr = new ToolStripProfessionalRenderer ();

			tsp.Renderer = pr;
			Assert.AreSame (pr, tsp.Renderer, "B1");
			Assert.AreEqual (ToolStripRenderMode.Custom, tsp.RenderMode, "B1-2");
			// I refuse to call the event twice like .Net does.
			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");

			ew.Clear ();
			tsp.Renderer = pr;
			//Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
Beispiel #53
0
 public ToolStripPanelRenderEventArgs(Graphics g, ToolStripPanel toolStripPanel)
 {
     throw null;
 }
		public void PropertyRenderMode ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.RenderMode = ToolStripRenderMode.System;
			Assert.AreEqual (ToolStripRenderMode.System, tsp.RenderMode, "B1");
			// I refuse to call the event twice like .Net does.
			//Assert.AreEqual ("RendererChanged;RendererChanged", ew.ToString (), "B2");

			ew.Clear ();
			tsp.RenderMode = ToolStripRenderMode.System;
			//Assert.AreEqual ("RendererChanged", ew.ToString (), "B3");
		}
Beispiel #55
0
 public ToolStripPanelRowCollection(ToolStripPanel owner, ToolStripPanelRow[] value)
 {
     _owner = owner;
     AddRange(value);
 }
		public void PropertyRowMargin ()
		{
			ToolStripPanel tsp = new ToolStripPanel ();
			EventWatcher ew = new EventWatcher (tsp);

			tsp.RowMargin = new Padding (4);
			Assert.AreEqual (new Padding (4), tsp.RowMargin, "B1");
			Assert.AreEqual (string.Empty, ew.ToString (), "B2");

			ew.Clear ();
			tsp.RowMargin = new Padding (4);
			Assert.AreEqual (string.Empty, ew.ToString (), "B3");
		}
Beispiel #57
0
 /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.Initialize"]/*' />
 protected internal virtual void InitializePanel(ToolStripPanel toolStripPanel)
 {
 }
Beispiel #58
0
 public ToolStripPanelRow(ToolStripPanel parent)
 {
     this.bounds   = Rectangle.Empty;
     this.controls = new List <Control> ();
     this.parent   = parent;
 }
Beispiel #59
0
 /// <include file='doc\ToolStripRenderer.uex' path='docs/doc[@for="ToolStripRenderer.Initialize"]/*' />
 protected internal virtual void InitializePanel(ToolStripPanel toolStripPanel){
 }
 public ToolStripPanelRenderEventArgs(Graphics g, ToolStripPanel toolStripPanel)
 {
     this.graphics         = g;
     this.tool_strip_panel = toolStripPanel;
     this.handled          = false;
 }