예제 #1
0
        private void ShowSubMenu(PopupMenuItem parentItem)
        {
            FlatPopupMenu subMenu = (FlatPopupMenu)subMenus[parentItem];

            if (subMenu == null)
            {
                return;
            }
            subMenu.Show();
            subMenu.Left = this.Left + this.Width;
            subMenu.Top  = this.Top + itemsBounds[SelectedIndex].Top - 1;
            subMenu.BringToFront();
        }
예제 #2
0
        private void CreateSubMenu(MenuItem parentItem)
        {
            if (parentItem.MenuItems == null || parentItem.MenuItems.Count == 0)
            {
                return;
            }
            FlatPopupMenu childMenu = new FlatPopupMenu();

            PopupMenuItem[] items = new PopupMenuItem[parentItem.MenuItems.Count];
            foreach (MenuItem item in parentItem.MenuItems)
            {
                items[parentItem.MenuItems.IndexOf(item)] = (PopupMenuItem)item;
            }
            childMenu.SetItems(items);
            this.Parent.Controls.Add(childMenu);
            subMenus.Add(parentItem, childMenu);
        }