Пример #1
0
        /// <summary>
        /// Setup constructor
        /// </summary>
        /// <param name="item">Tool strip item that this object is bound to</param>
        /// <param name="itemInfo">Item information</param>
        public MenuItem( ToolStripMenuItem item, MenuItemInfo itemInfo )
        {
            Arguments.CheckNotNull( item, "item" );
            Arguments.CheckNotNull( itemInfo, "itemInfo" );

            item.Name = itemInfo.Name;
            item.Text = itemInfo.Text;
            item.Tag = this;
            m_Item = item;
            m_Ordinal = itemInfo.Ordinal;
            m_Command = itemInfo.Command;
        }
Пример #2
0
 /// <summary>
 /// Finds or adds a new menu item matching the specified information
 /// </summary>
 public IMenuItem AddItem( MenuItemInfo itemInfo )
 {
     ToolStripItem item = m_Item.DropDownItems[ itemInfo.Name ];
     if ( item != null )
     {
         return ( IMenuItem )item.Tag;
     }
     ToolStripMenuItem menuItem = new ToolStripMenuItem( );
     InsertMenuItem( itemInfo.Ordinal, menuItem );
     if ( itemInfo.Command != null )
     {
         menuItem.Click += OnMenuItemClicked;
     }
     return new MenuItem( menuItem, itemInfo );
 }
Пример #3
0
 /// <summary>
 /// Finds or adds a new menu item matching the specified information
 /// </summary>
 public IMenuItem this[MenuItemInfo itemInfo]
 {
     get { return AddItem( itemInfo ); }
 }