System.Windows.Forms.ToolStripItemCollection.Insert C# (CSharp) Méthode

Insert() public méthode

public Insert ( int index, ToolStripItem value ) : void
index int
value ToolStripItem
Résultat void
		public void Insert (int index, ToolStripItem value)
		{
			if (value == null)
				throw new ArgumentNullException ("value");

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

			if (value.Owner != null)
				value.Owner.Items.Remove (value);
				
			base.Insert (index, value);
			
			if (internal_created) {
				value.InternalOwner = owner;
				owner.OnItemAdded (new ToolStripItemEventArgs (value));
			}
			
			if (owner.Created)
				owner.PerformLayout ();
		}
	}

Usage Example

Exemple #1
0
 public void AddMenuItem(ToolStripItemCollection collection, int index, String fileName, EventHandler handler)
 {
     ToolStripMenuItem item = new ToolStripMenuItem ();
     item.Text = fileName;
     item.Click += new EventHandler (handler);
     collection.Insert (index, item);
 }
All Usage Examples Of System.Windows.Forms.ToolStripItemCollection::Insert