コード例 #1
0
ファイル: FlatPopupMenu.cs プロジェクト: layerfsd/vAcademia
        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
ファイル: FlatPopupMenu.cs プロジェクト: layerfsd/vAcademia
        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);
        }