Пример #1
0
        /// <summary>
        /// Construct a new IconMenuItem and add it to the MenuMap attached to the Context
        /// Menu.  This menu map provides a quick and easy way to lookup and configure
        /// menu items in SetMenuitemStates.
        /// </summary>
        /// <param name="key"></param>
        /// <param name="tag"></param>
        /// <param name="icon"></param>
        /// <param name="text"></param>
        /// <param name="handler"></param>
        /// <returns></returns>

        private IconMenuItem MakeMenuItem(
            string key, object tag, System.Drawing.Icon icon, string text, EventHandler handler)
        {
            var item = new IconMenuItem(icon, text, handler)
            {
                Name = key
            };

            ((MenuMap)tag).Add(key, item);

            return(item);
        }
Пример #2
0
 /// <summary>
 /// Initializes an item with the specified icon and caption.
 /// </summary>
 /// <param name="icon">The icon resource to display</param>
 /// <param name="text">The caption text</param>
 /// <param name="handler"></param>
 public IconMenuItem(Icon icon, string text, IconMenuItem[] items)
     : this(text)
 {
     this.icon = icon;
     this.MenuItems.AddRange(items);
 }