Ejemplo n.º 1
0
 private void msMain_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     if (e.Item.Text == "" || e.Item.Text == "还原(&R)" || e.Item.Text == "最小化(&N)" || e.Item.Text == "关闭(&C)")
     {
         msMain.Items.RemoveAt(e.Item.MergeIndex);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// OnItemAdded-Event we adjust the font and forecolor of this item
        /// </summary>
        /// <param name="e"></param>
        protected override void OnItemAdded(ToolStripItemEventArgs e)
        {
            e.Item.Font = MetroUI.Style.BaseFont;
            e.Item.ForeColor = MetroUI.Style.ForeColor;

            base.OnItemAdded(e);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// OnItemAdded-Event we adjust the font and forecolor of this item
        /// </summary>
        /// <param name="e"></param>
        protected override void OnItemAdded(System.Windows.Forms.ToolStripItemEventArgs e)
        {
            base.OnItemAdded(e);

            e.Item.Font      = MetroFonts.Label(MetroLabelSize.Medium, MetroLabelWeight.Light);
            e.Item.ForeColor = MetroPaint.ForeColor.MenuToolStrip.Normal(Theme);
        }
Ejemplo n.º 4
0
        private void OnAfterRemove(ToolStripItem item)
        {
            if (_itemsCollection)
            {
                ToolStrip parent = null;
                if (item != null)
                {
                    parent = item.ParentInternal;
                    item.SetOwner(null);
                }

                if (_owner != null)
                {
                    _owner.OnItemRemovedInternal(item);

                    if (!_owner.IsDisposingItems)
                    {
                        ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
                        _owner.OnItemRemoved(e);

                        // dont fire the ItemRemoved event for Overflow
                        // it would fire constantly.... instead clear any state if the item
                        // is really being removed from the master collection.
                        if (parent != null && parent != _owner)
                        {
                            parent.OnItemVisibleChanged(e, /*performLayout*/ false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>顶部菜单-项添加事件</summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void menuTop_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     if (e.Item.Text.Length == 0)
     {
         e.Item.Visible = false;
     }
 }
 protected override void OnItemAdded(ToolStripItemEventArgs e)
 {
     if (SecurityExclude(e.Item))
         Items.Remove(e.Item);
     else
         base.OnItemAdded(e);
 }
        private void OnItemRemoved(object sender, ToolStripItemEventArgs e)
        {
            if (e.Item != _item)
                return;

            RegisterEvents(register: false);
            _lifetime.Dispose();
        }
Ejemplo n.º 8
0
 /// <summary>
 /// When button is added, listen for it's hover events
 /// </summary>
 private void OnItemAdded(Object sender, ToolStripItemEventArgs e)
 {
     if (e.Item is ToolStripButton)
     {
         e.Item.MouseEnter += new EventHandler(this.OnOverChange);
         e.Item.MouseLeave += new EventHandler(this.OnOverChange);
     }
 }
Ejemplo n.º 9
0
        private void menuStrip1_ItemAdded(object sender, ToolStripItemEventArgs e)
        {
            if (e.Item.Text.Length == 0 || e.Item.Text == "还原(&R)" || e.Item.Text == "最小化(&N)"||e.Item.Text == "关闭(&C)")

            {
                e.Item.Visible = false;
            }
        }
Ejemplo n.º 10
0
 protected override void OnItemAdded(ToolStripItemEventArgs e)
 {
     base.OnItemAdded(e);
     if (e.Item is TabStripButton)
     {
         SelectedTab = (TabStripButton)e.Item;
     }
 }
Ejemplo n.º 11
0
        protected internal virtual void OnItemRemoved(ToolStripItemEventArgs e)
        {
            ToolStripItemEventHandler eh = (ToolStripItemEventHandler)(Events [ItemRemovedEvent]);

            if (eh != null)
            {
                eh(this, e);
            }
        }
Ejemplo n.º 12
0
 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡο����Ӧ����
 void m_obRight_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     m_obContRight.Width = 900;
     int width = Button_item_slot;
     for (int i = 0; i < m_obRight.Items.Count; i++)
     {
         width += m_obRight.Items[i].Width;
     }
     m_obContRight.Width = width;
 }
Ejemplo n.º 13
0
        protected override void OnItemAdded(ToolStripItemEventArgs e)
        {
            var button = e.Item as ToolStripButton;

            if (button != null)
                button.CheckedChanged += button_CheckedChanged;

            var dropDownButton = e.Item as ToolStripDropDownButton;

            if (dropDownButton != null)
                dropDownButton.DropDownItemClicked += dropDownButton_DropDownItemClicked;

            base.OnItemAdded(e);
        }
 private void OnAfterRemove(ToolStripItem item)
 {
     if (this.itemsCollection)
     {
         ToolStrip parentInternal = null;
         if (item != null)
         {
             parentInternal = item.ParentInternal;
             item.SetOwner(null);
         }
         if ((this.owner != null) && !this.owner.IsDisposingItems)
         {
             ToolStripItemEventArgs e = new ToolStripItemEventArgs(item);
             this.owner.OnItemRemoved(e);
             if ((parentInternal != null) && (parentInternal != this.owner))
             {
                 parentInternal.OnItemVisibleChanged(e, false);
             }
         }
     }
 }
        protected internal virtual void OnItemAdded(ToolStripItemEventArgs e)
        {
            if (e.Item.InternalVisible)
            {
                e.Item.Available = true;
            }

            m_helper.AddItem(e.Item);            //(e.Item.Text,0);
            //e.Item.SetPlacement (ToolStripItemPlacement.Main);


            if (this.Created)
            {
                this.PerformLayout();
            }

            ToolStripItemEventHandler eh = (ToolStripItemEventHandler)(Events [ItemAddedEvent]);

            if (eh != null)
            {
                eh(this, e);
            }
        }
Ejemplo n.º 16
0
        internal void ItemAdded(object sender, ToolStripItemEventArgs e)
        {
            if (e.Item is IActionNameContainer)
            {
                var anc = e.Item as IActionNameContainer;
                if (anc.ActionName != ActionNames.None)
                {
                    actionitems.Add(anc.ActionName.ToString(), e.Item as ToolStripItem);
                    var actionManager = Services.ServiceProvider.GetInstance().GetService<IActionManager>();
                    actionManager.Actions[anc.ActionName].EnabledChanged +=
                        new EventHandler(ActionEnabledChanged);
                }
            }

            if (e.Item is ToolStripMenuItem)
            {
                var menuItem = (e.Item as ToolStripMenuItem);
                menuItem.Click += new EventHandler(ItemClick);
                foreach (System.Windows.Forms.ToolStripItem subitem in menuItem.DropDownItems)
                {
                    ItemAdded(e.Item, new ToolStripItemEventArgs(subitem));
                }
            }
        }
Ejemplo n.º 17
0
 private void menuMain_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     if (e.Item.Text == "")
     {
         e.Item.Image = null;
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.ToolStrip.ItemAdded"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.ToolStripItemEventArgs"/> that contains the event data.</param>
        protected override void OnItemAdded(ToolStripItemEventArgs e)
        {
            base.OnItemAdded(e);

            if (ProgressBar == null)
            {
                ToolStripProgressBar pb = e.Item as ToolStripProgressBar;
                if (pb != null)
                {
                    ProgressBar = pb;
                }
            }

            if (ProgressLabel == null)
            {
                ToolStripStatusLabel sl = e.Item as ToolStripStatusLabel;
                if (sl != null)
                {
                    ProgressLabel = sl;
                }
            }
        }
 protected internal override void OnItemAdded(ToolStripItemEventArgs e)
 {
     base.OnItemAdded(e);
 }
Ejemplo n.º 20
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handles removing an item's separator (if it has one) from its owning ToolStrip.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		static void HandleItemRemovedFromOwner(object sender, ToolStripItemEventArgs e)
		{
			ToolStripItemExtender extender;
			if (s_extenders.TryGetValue(e.Item, out extender))
				extender.RemoveSeparator(sender as ToolStrip);
		}
 protected internal virtual void OnItemAdded(ToolStripItemEventArgs e)
 {
     this.DoLayoutIfHandleCreated(e);
     if ((!this.HasVisibleItems && (e.Item != null)) && ((IArrangedElement) e.Item).ParticipatesInLayout)
     {
         this.HasVisibleItems = true;
     }
     ToolStripItemEventHandler handler = (ToolStripItemEventHandler) base.Events[EventItemAdded];
     if (handler != null)
     {
         handler(this, e);
     }
 }
 internal void OnItemVisibleChanged(ToolStripItemEventArgs e, bool performLayout)
 {
     if (e.Item == this.lastMouseActiveItem)
     {
         this.lastMouseActiveItem = null;
     }
     if (e.Item == this.LastMouseDownedItem)
     {
         this.lastMouseDownedItem = null;
     }
     if (e.Item == this.currentlyActiveTooltipItem)
     {
         this.UpdateToolTip(null);
     }
     if (performLayout)
     {
         this.DoLayoutIfHandleCreated(e);
     }
 }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// toolstripitemeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this ToolStripItemEventHandler toolstripitemeventhandler, Object sender, ToolStripItemEventArgs e, AsyncCallback callback)
        {
            if(toolstripitemeventhandler == null) throw new ArgumentNullException("toolstripitemeventhandler");

            return toolstripitemeventhandler.BeginInvoke(sender, e, callback, null);
        }
Ejemplo n.º 24
0
 protected void OnColumnCountChanged(object sender, SWF.ToolStripItemEventArgs e)
 {
     RaiseAutomationPropertyChangedEvent();
 }
Ejemplo n.º 25
0
		private void OnItemAdded (object sender, ToolStripItemEventArgs e)
		{
			FragmentControlProvider itemProvider = GetItemProvider (e.Item);
			if (itemProvider != null)
				AddChildProvider (itemProvider);
		}
Ejemplo n.º 26
0
		private void OnItemRemoved (object sender, ToolStripItemEventArgs e)
		{
			FragmentControlProvider itemProvider = GetItemProvider (e.Item);
			if (itemProvider != null) {
				itemProviders.Remove (e.Item);
				itemProvider.Terminate ();
				RemoveChildProvider (itemProvider);
			}
		}
 protected internal override void OnItemAdded(ToolStripItemEventArgs e)
 {
     base.OnItemAdded(e);
 }
 private void OnItemAdded(object sender, ToolStripItemEventArgs e)
 {
     if ((this.editorNode != null) && (e.Item != this.editorNode))
     {
         int index = this.ToolStrip.Items.IndexOf(this.editorNode);
         if ((index == -1) || (index != (this.ToolStrip.Items.Count - 1)))
         {
             this.ToolStrip.ItemAdded -= new ToolStripItemEventHandler(this.OnItemAdded);
             this.ToolStrip.SuspendLayout();
             this.ToolStrip.Items.Add(this.editorNode);
             this.ToolStrip.ResumeLayout();
             this.ToolStrip.ItemAdded += new ToolStripItemEventHandler(this.OnItemAdded);
         }
     }
     this.LayoutToolStrip();
 }
Ejemplo n.º 29
0
 protected internal override void OnItemAdded(ToolStripItemEventArgs e) {
     base.OnItemAdded(e);
     Debug.Assert(Items.Count <= 4, "Too many items in the MDIControlStrip.  How did we get into this situation?");    
 }
Ejemplo n.º 30
0
		private void menuStrip_ItemAdded(object sender, ToolStripItemEventArgs e)
		{
			// Translate the items in the menu by finding their Tags in the translation file.
			foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType<ToolStripMenuItem>())
			{
				if (objItem.Tag != null)
				{
					objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
				}
			}
		}
Ejemplo n.º 31
0
 protected override void OnItemRemoved(ToolStripItemEventArgs e)
 {
     QMenuItem qmi = e.Item as QMenuItem;
     if(IsQmiResponds(qmi)) {
         lstQMIResponds.Remove(qmi);
     }
     base.OnItemRemoved(e);
 }
Ejemplo n.º 32
0
		private void toolStrip_ItemRemoved(object sender, ToolStripItemEventArgs e)
		{
			// ToolStrip Items.
			foreach (ToolStrip objToolStrip in this.Controls.OfType<ToolStrip>())
			{
				foreach (ToolStripButton objButton in objToolStrip.Items.OfType<ToolStripButton>())
				{
					if (objButton.Tag != null)
						objButton.Text = LanguageManager.Instance.GetString(objButton.Tag.ToString());
				}
			}
		}
Ejemplo n.º 33
0
		protected internal virtual void OnItemAdded (ToolStripItemEventArgs e)
		{
			if (e.Item.InternalVisible)
				e.Item.Available = true;
				
			e.Item.SetPlacement (ToolStripItemPlacement.Main);
			
			if (this.Created)
				this.PerformLayout ();
			
			ToolStripItemEventHandler eh = (ToolStripItemEventHandler)(Events [ItemAddedEvent]);
			if (eh != null)
				eh (this, e);
		}
Ejemplo n.º 34
0
 private void DropDown_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     e.Item.owner_item = this;
 }
Ejemplo n.º 35
0
		protected internal virtual void OnItemRemoved (ToolStripItemEventArgs e)
		{
			ToolStripItemEventHandler eh = (ToolStripItemEventHandler)(Events [ItemRemovedEvent]);
			if (eh != null)
				eh (this, e);
		}
 protected internal virtual void OnItemRemoved(ToolStripItemEventArgs e)
 {
     this.OnItemVisibleChanged(e, true);
     ToolStripItemEventHandler handler = (ToolStripItemEventHandler) base.Events[EventItemRemoved];
     if (handler != null)
     {
         handler(this, e);
     }
 }
 private void tsTop_ItemAdded(object sender, ToolStripItemEventArgs e)
 {
     if (this.tlpContent.Padding.Left != 0x17)
     {
         this.tlpContent.Padding = new Padding(0x17, 0, 0, 0);
     }
 }
 internal void DoLayoutIfHandleCreated(ToolStripItemEventArgs e)
 {
     if (base.IsHandleCreated)
     {
         LayoutTransaction.DoLayout(this, e.Item, PropertyNames.Items);
         base.Invalidate();
         if (this.CanOverflow && this.OverflowButton.HasDropDown)
         {
             if (this.DeferOverflowDropDownLayout())
             {
                 CommonProperties.xClearPreferredSizeCache(this.OverflowButton.DropDown);
                 this.OverflowButton.DropDown.LayoutRequired = true;
             }
             else
             {
                 LayoutTransaction.DoLayout(this.OverflowButton.DropDown, e.Item, PropertyNames.Items);
                 this.OverflowButton.DropDown.Invalidate();
             }
         }
     }
     else
     {
         CommonProperties.xClearPreferredSizeCache(this);
         this.LayoutRequired = true;
         if (this.CanOverflow && this.OverflowButton.HasDropDown)
         {
             this.OverflowButton.DropDown.LayoutRequired = true;
         }
     }
 }
Ejemplo n.º 39
0
 protected internal override void OnItemAdded(ToolStripItemEventArgs e)
 {
     base.OnItemAdded(e);
     Debug.Assert(Items.Count <= 4, "Too many items in the MDIControlStrip.  How did we get into this situation?");
 }
Ejemplo n.º 40
0
 protected override void OnItemAdded(System.Windows.Forms.ToolStripItemEventArgs e)
 {
     base.OnItemAdded(e);
 }
Ejemplo n.º 41
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Handles adding an item's separator (if it has one) to its owning ToolStrip.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private static void HandleItemAddedToOwner(object sender, ToolStripItemEventArgs e)
		{
			ToolStripItemExtender extender;
			if (s_extenders.TryGetValue(e.Item, out extender))
				extender.AddSeparator(sender as ToolStrip);
		}