202 references to MenuItem
System.Windows.Forms.Design (202)
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (202)
87if (MenuItem.DropDown.IsAutoGenerated) 89foreach (ToolStripItem item in MenuItem.DropDownItems) 130if (MenuItem.DropDown is not null) 132RemoveTypeHereNode(MenuItem); 135if (MenuItem.DropDown.IsAutoGenerated && MenuItem.DropDownItems.Count > 0) 141foreach (ToolStripItem item in MenuItem.DropDownItems) 154ToolStripItem[] items = new ToolStripItem[MenuItem.DropDownItems.Count]; 155MenuItem.DropDownItems.CopyTo(items, 0); 158MenuItem.DropDownItems.Remove(item); 163MenuItem.HideDropDown(); 167MenuItem.DropDown = value; 191MenuItem.DropDown.OwnerItem = MenuItem; 192MenuItem.DropDown.Disposed += OnDropDownDisposed; 195if (MenuItem.Equals(_selectionService.PrimarySelection)) 286return (toolItem == MenuItem); 295return (parentItem == MenuItem); 299return (toolItem == MenuItem); 305&& MenuItem.DropDown == selectedItem) 333if (MenuItem.Owner is ToolStripDropDown dropDown) 428if (!(MenuItem.Owner is ToolStripDropDown) && base.Editor is not null) // we are on Base MenuStrip !! 436MenuItem.DropDown.SuspendLayout(); 441index = MenuItem.DropDownItems.IndexOf(_commitedEditorNode); 442ToolStripItem editedItem = MenuItem.DropDownItems[index + 1]; 445MenuItem.DropDown.Items.Remove(_commitedEditorNode); 559index = MenuItem.DropDownItems.IndexOf(_typeHereNode); 575MenuItem.DropDown.ResumeLayout(true); 576MenuItem.DropDown.PerformLayout(); 578ResetGlyphs(MenuItem); 584ToolStripItem nextItem = (MenuItem.DropDownDirection == ToolStripDropDownDirection.AboveLeft || 585MenuItem.DropDownDirection == ToolStripDropDownDirection.AboveRight) && index >= 1 586? MenuItem.DropDownItems[index - 1] 587: MenuItem.DropDownItems[index + 1]; 593if (MenuItem.DropDownItems[index] is ToolStripDropDownItem currentItem) 614_selectionService.SetSelectedComponents(new object[] { MenuItem.DropDownItems[index] }, SelectionTypes.Replace); 624MenuItem.DropDown.SuspendLayout(); 627int index = MenuItem.DropDownItems.IndexOf(_commitedEditorNode); 628ToolStripItem editedItem = MenuItem.DropDownItems[index + 1]; 629MenuItem.DropDown.Items.Remove(_commitedEditorNode); 640MenuItem.DropDownItems.Remove(editedItem); 665MenuItem.DropDown.ResumeLayout(); 686if (MenuItem.DropDownItems.Count == 0) 699MenuItem.DropDown.PerformLayout(); 711AddNewTemplateNode(MenuItem.DropDown); 713if (MenuItem.DropDown.Site is null) 715MenuItem.DropDown.Text = $"{MenuItem.Name}.DropDown"; 718else if (_typeHereNode is not null && MenuItem.DropDownItems.IndexOf(_typeHereNode) == -1) 720MenuItem.DropDown.Items.Add(_typeHereNode); 725MenuItem.DropDown.PerformLayout(); 760if (MenuItem.DropDownDirection is ToolStripDropDownDirection.AboveLeft or ToolStripDropDownDirection.AboveRight) 832if (MenuItem.DropDownDirection is ToolStripDropDownDirection.AboveLeft or ToolStripDropDownDirection.AboveRight) 848newItem = (ToolStripItem)_designerHost.CreateComponent(t, ToolStripDesigner.NameFromText(newText, t, MenuItem.Site)); 928int index = MenuItem.DropDownItems.IndexOf(_commitedEditorNode); 930if (index != -1 && MenuItem.DropDownItems.Count > index) 932if (MenuItem.DropDownItems[index] is ToolStripDropDownItem newItem) 944ToolStripDropDownItem currentItem = MenuItem; 972if (MenuItem is not null && MenuItem.HasDropDown) 974MenuItem.DropDown.Hide(); 1036if (_selectionService is not null && MenuItem is not null) 1038foreach (ToolStripItem item in MenuItem.DropDownItems) 1205if (MenuItem is null) 1215_selectionService.SetSelectedComponents(new object[] { MenuItem }, SelectionTypes.Replace); 1237if (selectedItem is not null && selectedItem != MenuItem) 1242MenuItem.DropDown.SuspendLayout(); 1244int index = MenuItem.DropDownItems.IndexOf(_typeHereNode); 1271MenuItem.DropDown.ResumeLayout(); 1288if (MenuItem.Owner is ToolStripDropDown dropDown) 1298MenuItem.HideDropDown(); 1299menuItemDesigner.EnterInSituEdit(MenuItem); 1310MenuItem.DropDown.SuspendLayout(); 1326int index = MenuItem.DropDownItems.IndexOf(toolItem); 1328MenuItem.DropDownItems.Insert(index, _commitedEditorNode); 1335MenuItem.DropDown.ResumeLayout(); 1372return MenuItem; 1378ToolStripDropDown topmost = GetFirstDropDown(MenuItem); 1385return MenuItem.Owner; 1395if (MenuItem.Owner is ToolStripDropDown dropDown) 1428ToolStripItem ownerItem = MenuItem; 1453if (MenuItem is not null) 1455MenuItem.DropDown.Closing += OnDropDownClosing; 1456MenuItem.DropDownOpening += DropDownItem_DropDownOpening; 1457MenuItem.DropDownOpened += DropDownItem_DropDownOpened; 1458MenuItem.DropDownClosed += DropDownItem_DropDownClosed; 1459MenuItem.DropDown.Resize += DropDownResize; 1460MenuItem.DropDown.ItemAdded += OnItemAdded; 1461MenuItem.DropDown.Paint += DropDownPaint; 1462MenuItem.DropDown.Click += DropDownClick; 1463MenuItem.DropDown.LocationChanged += DropDownLocationChanged; 1476DoubleClickEnabled = MenuItem.DoubleClickEnabled; 1489MenuItem.DoubleClickEnabled = true; 1527ToolStripDropDown firstDropDown = GetFirstDropDown(MenuItem); 1543if (MenuItem.DropDown.OwnerItem is ToolStripDropDownItem currentOwner && currentOwner != MenuItem) 1554if (MenuItem.DropDown.Site is not null) 1556if (_designerHost.GetDesigner(MenuItem.DropDown) is ToolStripDropDownDesigner designer) 1558designer._currentParent = MenuItem as ToolStripMenuItem; 1563MenuItem.DropDown.TopLevel = false; 1566MenuItem.DropDown.AllowDrop = true; 1568MenuItem.DropDown.AutoClose = false; 1569MenuItem.ShowDropDown(); 1570ShowOwnerDropDown(MenuItem); 1573ResetGlyphs(MenuItem); 1581GetService<BehaviorService>()?.Invalidate(MenuItem.Owner.Bounds); 1589ToolStripDropDown startDropDown = MenuItem.Owner as ToolStripDropDown; 1619Rectangle hostingDropDownBounds = (MenuItem.GetCurrentParent()).Bounds; 1621Rectangle itemDropDownBounds = MenuItem.DropDown.Bounds; 1623InitializeBodyGlyphsForItems(false /*remove*/, MenuItem); 1646if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1650MemberDescriptor member = TypeDescriptor.GetProperties(MenuItem.DropDown)["Items"]; 1651changeService.OnComponentChanging(MenuItem.DropDown, member); 1656RaiseComponentChanging(TypeDescriptor.GetProperties(MenuItem)["DropDownItems"]); 1660int count = MenuItem.DropDownItems.Count; 1665if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1667MenuItem.DropDown.Items.Insert(_indexToInsertNewItem, newItem); 1671MenuItem.DropDownItems.Insert(_indexToInsertNewItem, newItem); 1677if (_selectionService.PrimarySelection is ToolStripItem selectedItem && selectedItem != MenuItem) 1679int index = MenuItem.DropDownItems.IndexOf(selectedItem); 1680if (MenuItem.DropDownDirection is ToolStripDropDownDirection.AboveLeft or ToolStripDropDownDirection.AboveRight) 1683if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1685MenuItem.DropDown.Items.Insert(index + 1, newItem); 1689MenuItem.DropDownItems.Insert(index + 1, newItem); 1694if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1696MenuItem.DropDown.Items.Insert(index, newItem); 1700MenuItem.DropDownItems.Insert(index, newItem); 1708if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 1711if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1713MenuItem.DropDown.Items.Insert(count - 1, newItem); 1717MenuItem.DropDownItems.Insert(count - 1, newItem); 1723if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1725MenuItem.DropDown.Items.Add(newItem); 1729MenuItem.DropDownItems.Add(newItem); 1741ResetGlyphs(MenuItem); 1749if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1753MemberDescriptor member = TypeDescriptor.GetProperties(MenuItem.DropDown)["Items"]; 1754changeService.OnComponentChanged(MenuItem.DropDown, member); 1759RaiseComponentChanged(TypeDescriptor.GetProperties(MenuItem)["DropDownItems"], null, null); 1850if (ownerItem is not null && ownerItem == MenuItem) 1885regionToInvalidate.Exclude(MenuItem.DropDown.Bounds); 1900KeyboardHandlingService.OwnerItemAfterCut = MenuItem; 1930if (ownerItem is not null && ownerItem == MenuItem) 1972if (MenuItem is not null) 1974MenuItem.DropDown?.Disposed -= OnDropDownDisposed; 1977MenuItem.DropDown = null; 1987if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 1991int currentIndexOfEditor = MenuItem.DropDown.Items.IndexOf(_typeHereNode); 1992if (currentIndexOfEditor >= 0 && currentIndexOfEditor < MenuItem.DropDown.Items.Count - 1) 1995MenuItem.DropDown.ItemAdded -= OnItemAdded; 1996MenuItem.DropDown.SuspendLayout(); 1997MenuItem.DropDown.Items.Remove(_typeHereNode); 1998MenuItem.DropDown.Items.Add(_typeHereNode); 1999MenuItem.DropDown.ResumeLayout(); 2000MenuItem.DropDown.ItemAdded += OnItemAdded; 2018if (_dropDownSet && MenuItem.DropDown.IsAutoGenerated) 2025MenuItem.DropDownItems.Insert(0, item); 2031ResetGlyphs(MenuItem); 2035if (MenuItem is not null && _selectionService.GetComponentSelected(MenuItem)) 2038MenuItem.DropDown.PerformLayout(); 2046if (_selectionService.GetComponentSelected(MenuItem) && !_dropDownSetFailed) 2062if (!IsOnContextMenu && MenuItem.DropDown.Visible) 2064MenuItem.HideDropDown(); 2066if (!MenuItem.DropDown.IsAutoGenerated) 2088if (MenuItem is null) 2110if (MenuItem.Equals(selectionSvc.PrimarySelection)) 2115ToolStripDesignerUtils.InvalidateSelection(origSel, MenuItem, MenuItem.Site, false /*shift pressed*/); 2118if (IsOnContextMenu && !MenuItem.Owner.Visible) 2120ToolStripDropDown firstDropDown = GetFirstDropDown(MenuItem); 2171if (parent.OwnerItem == MenuItem || parent.OwnerItem is null) 2182if (MenuItem.DropDown.Visible) 2187if (selectedObj is ToolStripDropDown selectedDropDown && MenuItem.DropDown == selectedDropDown) 2199if (parent == MenuItem.DropDown) 2212if (MenuItem.DropDown.OwnerItem == MenuItem) 2214MenuItem.HideDropDown(); 2265private void RestoreVisible() => MenuItem.Visible = Visible; 2300int index = MenuItem.DropDownItems.IndexOf(_commitedEditorNode); 2302ToolStripDropDownItem editedItem = (ToolStripDropDownItem)MenuItem.DropDownItems[index + 1]; 2305MenuItem.DropDown.Items.Remove(_commitedEditorNode); 2392if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 2395count = MenuItem.DropDownItems.Count; 2399_selectionService.SetSelectedComponents(new object[] { MenuItem }, SelectionTypes.Replace); 2402KeyboardHandlingService.SelectedDesignerControl = MenuItem.DropDownItems[count]; 2439if (MenuItem is null) 2446if (MenuItem.Owner is ToolStripDropDown dropDown) 2455menuItemDesigner.EnterInSituEdit(MenuItem); 2485ToolStripDropDown ownerDropDown = (ToolStripDropDown)MenuItem.Owner; 2486int maxIndex = Math.Max(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem)); 2487int minIndex = Math.Min(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem)); 2529if (MenuItem is not null) 2531MenuItem.DropDown.Closing -= OnDropDownClosing; 2532MenuItem.DropDownOpening -= DropDownItem_DropDownOpening; 2533MenuItem.DropDownOpened -= DropDownItem_DropDownOpened; 2534MenuItem.DropDownClosed -= DropDownItem_DropDownClosed; 2535MenuItem.DropDown.Resize -= DropDownResize; 2536MenuItem.DropDown.ItemAdded -= OnItemAdded; 2537MenuItem.DropDown.Paint -= DropDownPaint; 2538MenuItem.DropDown.LocationChanged -= DropDownLocationChanged; 2539MenuItem.DropDown.Click -= DropDownClick;