OnItemAdded() protected method

protected OnItemAdded ( System.Windows.Forms.ToolStripItemEventArgs e ) : void
e System.Windows.Forms.ToolStripItemEventArgs
return void
コード例 #1
0
        /// <include file='doc\ToolStripItemCollection.uex' path='docs/doc[@for="ToolStripItemCollection.Add"]/*' />
        public int Add(ToolStripItem value)
        {
            CheckCanAddOrInsertItem(value);

            SetOwner(value);
            int retVal = InnerList.Add(value);

            if (itemsCollection && owner != null)
            {
                owner.OnItemAddedInternal(value);
                owner.OnItemAdded(new ToolStripItemEventArgs(value));
            }
            return(retVal);
        }
コード例 #2
0
        public int Add(ToolStripItem value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            value.InternalOwner = owner;

            if (value is ToolStripMenuItem && (value as ToolStripMenuItem).ShortcutKeys != Keys.None)
            {
                ToolStripManager.AddToolStripMenuItem((ToolStripMenuItem)value);
            }

            int index = base.Add(value);

            if (this.internal_created)
            {
                owner.OnItemAdded(new ToolStripItemEventArgs(value));
            }

            return(index);
        }