203 references to MenuItem
System.Windows.Forms.Design (203)
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (203)
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; 975if (MenuItem is not null && MenuItem.HasDropDown) 977MenuItem.DropDown.Hide(); 1039if (_selectionService is not null && MenuItem is not null) 1041foreach (ToolStripItem item in MenuItem.DropDownItems) 1208if (MenuItem is null) 1218_selectionService.SetSelectedComponents(new object[] { MenuItem }, SelectionTypes.Replace); 1240if (selectedItem is not null && selectedItem != MenuItem) 1245MenuItem.DropDown.SuspendLayout(); 1247int index = MenuItem.DropDownItems.IndexOf(_typeHereNode); 1274MenuItem.DropDown.ResumeLayout(); 1291if (MenuItem.Owner is ToolStripDropDown dropDown) 1301MenuItem.HideDropDown(); 1302menuItemDesigner.EnterInSituEdit(MenuItem); 1313MenuItem.DropDown.SuspendLayout(); 1329int index = MenuItem.DropDownItems.IndexOf(toolItem); 1331MenuItem.DropDownItems.Insert(index, _commitedEditorNode); 1338MenuItem.DropDown.ResumeLayout(); 1375return MenuItem; 1381ToolStripDropDown topmost = GetFirstDropDown(MenuItem); 1388return MenuItem.Owner; 1398if (MenuItem.Owner is ToolStripDropDown dropDown) 1431ToolStripItem ownerItem = MenuItem; 1456if (MenuItem is not null) 1458MenuItem.DropDown.Closing += OnDropDownClosing; 1459MenuItem.DropDownOpening += DropDownItem_DropDownOpening; 1460MenuItem.DropDownOpened += DropDownItem_DropDownOpened; 1461MenuItem.DropDownClosed += DropDownItem_DropDownClosed; 1462MenuItem.DropDown.Resize += DropDownResize; 1463MenuItem.DropDown.ItemAdded += OnItemAdded; 1464MenuItem.DropDown.Paint += DropDownPaint; 1465MenuItem.DropDown.Click += DropDownClick; 1466MenuItem.DropDown.LocationChanged += DropDownLocationChanged; 1479DoubleClickEnabled = MenuItem.DoubleClickEnabled; 1492MenuItem.DoubleClickEnabled = true; 1530ToolStripDropDown firstDropDown = GetFirstDropDown(MenuItem); 1546if (MenuItem.DropDown.OwnerItem is ToolStripDropDownItem currentOwner && currentOwner != MenuItem) 1557if (MenuItem.DropDown.Site is not null) 1559if (_designerHost.GetDesigner(MenuItem.DropDown) is ToolStripDropDownDesigner designer) 1561designer._currentParent = MenuItem as ToolStripMenuItem; 1566MenuItem.DropDown.TopLevel = false; 1569MenuItem.DropDown.AllowDrop = true; 1571MenuItem.DropDown.AutoClose = false; 1572MenuItem.ShowDropDown(); 1573ShowOwnerDropDown(MenuItem); 1576ResetGlyphs(MenuItem); 1584GetService<BehaviorService>()?.Invalidate(MenuItem.Owner.Bounds); 1592ToolStripDropDown startDropDown = MenuItem.Owner as ToolStripDropDown; 1622Rectangle hostingDropDownBounds = (MenuItem.GetCurrentParent()).Bounds; 1624Rectangle itemDropDownBounds = MenuItem.DropDown.Bounds; 1626InitializeBodyGlyphsForItems(false /*remove*/, MenuItem); 1649if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1653MemberDescriptor member = TypeDescriptor.GetProperties(MenuItem.DropDown)["Items"]; 1654changeService.OnComponentChanging(MenuItem.DropDown, member); 1659RaiseComponentChanging(TypeDescriptor.GetProperties(MenuItem)["DropDownItems"]); 1663int count = MenuItem.DropDownItems.Count; 1668if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1670MenuItem.DropDown.Items.Insert(_indexToInsertNewItem, newItem); 1674MenuItem.DropDownItems.Insert(_indexToInsertNewItem, newItem); 1680if (_selectionService.PrimarySelection is ToolStripItem selectedItem && selectedItem != MenuItem) 1682int index = MenuItem.DropDownItems.IndexOf(selectedItem); 1683if (MenuItem.DropDownDirection is ToolStripDropDownDirection.AboveLeft or ToolStripDropDownDirection.AboveRight) 1686if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1688MenuItem.DropDown.Items.Insert(index + 1, newItem); 1692MenuItem.DropDownItems.Insert(index + 1, newItem); 1697if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1699MenuItem.DropDown.Items.Insert(index, newItem); 1703MenuItem.DropDownItems.Insert(index, newItem); 1711if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 1714if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1716MenuItem.DropDown.Items.Insert(count - 1, newItem); 1720MenuItem.DropDownItems.Insert(count - 1, newItem); 1726if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1728MenuItem.DropDown.Items.Add(newItem); 1732MenuItem.DropDownItems.Add(newItem); 1744ResetGlyphs(MenuItem); 1752if (IsOnContextMenu && MenuItem.DropDown.Site is not null) 1756MemberDescriptor member = TypeDescriptor.GetProperties(MenuItem.DropDown)["Items"]; 1757changeService.OnComponentChanged(MenuItem.DropDown, member); 1762RaiseComponentChanged(TypeDescriptor.GetProperties(MenuItem)["DropDownItems"], null, null); 1853if (ownerItem is not null && ownerItem == MenuItem) 1888regionToInvalidate.Exclude(MenuItem.DropDown.Bounds); 1903KeyboardHandlingService.OwnerItemAfterCut = MenuItem; 1933if (ownerItem is not null && ownerItem == MenuItem) 1975if (MenuItem is not null) 1977if (MenuItem.DropDown is not null) 1979MenuItem.DropDown.Disposed -= OnDropDownDisposed; 1983MenuItem.DropDown = null; 1993if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 1997int currentIndexOfEditor = MenuItem.DropDown.Items.IndexOf(_typeHereNode); 1998if (currentIndexOfEditor >= 0 && currentIndexOfEditor < MenuItem.DropDown.Items.Count - 1) 2001MenuItem.DropDown.ItemAdded -= OnItemAdded; 2002MenuItem.DropDown.SuspendLayout(); 2003MenuItem.DropDown.Items.Remove(_typeHereNode); 2004MenuItem.DropDown.Items.Add(_typeHereNode); 2005MenuItem.DropDown.ResumeLayout(); 2006MenuItem.DropDown.ItemAdded += OnItemAdded; 2024if (_dropDownSet && MenuItem.DropDown.IsAutoGenerated) 2031MenuItem.DropDownItems.Insert(0, item); 2037ResetGlyphs(MenuItem); 2041if (MenuItem is not null && _selectionService.GetComponentSelected(MenuItem)) 2044MenuItem.DropDown.PerformLayout(); 2052if (_selectionService.GetComponentSelected(MenuItem) && !_dropDownSetFailed) 2068if (!IsOnContextMenu && MenuItem.DropDown.Visible) 2070MenuItem.HideDropDown(); 2072if (!MenuItem.DropDown.IsAutoGenerated) 2094if (MenuItem is null) 2116if (MenuItem.Equals(selectionSvc.PrimarySelection)) 2121ToolStripDesignerUtils.InvalidateSelection(origSel, MenuItem, MenuItem.Site, false /*shift pressed*/); 2124if (IsOnContextMenu && !MenuItem.Owner.Visible) 2126ToolStripDropDown firstDropDown = GetFirstDropDown(MenuItem); 2177if (parent.OwnerItem == MenuItem || parent.OwnerItem is null) 2188if (MenuItem.DropDown.Visible) 2193if (selectedObj is ToolStripDropDown selectedDropDown && MenuItem.DropDown == selectedDropDown) 2205if (parent == MenuItem.DropDown) 2218if (MenuItem.DropDown.OwnerItem == MenuItem) 2220MenuItem.HideDropDown(); 2271private void RestoreVisible() => MenuItem.Visible = Visible; 2306int index = MenuItem.DropDownItems.IndexOf(_commitedEditorNode); 2308ToolStripDropDownItem editedItem = (ToolStripDropDownItem)MenuItem.DropDownItems[index + 1]; 2311MenuItem.DropDown.Items.Remove(_commitedEditorNode); 2398if (MenuItem.DropDownDirection is not ToolStripDropDownDirection.AboveLeft and not ToolStripDropDownDirection.AboveRight) 2401count = MenuItem.DropDownItems.Count; 2405_selectionService.SetSelectedComponents(new object[] { MenuItem }, SelectionTypes.Replace); 2408KeyboardHandlingService.SelectedDesignerControl = MenuItem.DropDownItems[count]; 2445if (MenuItem is null) 2452if (MenuItem.Owner is ToolStripDropDown dropDown) 2461menuItemDesigner.EnterInSituEdit(MenuItem); 2491ToolStripDropDown ownerDropDown = (ToolStripDropDown)MenuItem.Owner; 2492int maxIndex = Math.Max(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem)); 2493int minIndex = Math.Min(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem)); 2535if (MenuItem is not null) 2537MenuItem.DropDown.Closing -= OnDropDownClosing; 2538MenuItem.DropDownOpening -= DropDownItem_DropDownOpening; 2539MenuItem.DropDownOpened -= DropDownItem_DropDownOpened; 2540MenuItem.DropDownClosed -= DropDownItem_DropDownClosed; 2541MenuItem.DropDown.Resize -= DropDownResize; 2542MenuItem.DropDown.ItemAdded -= OnItemAdded; 2543MenuItem.DropDown.Paint -= DropDownPaint; 2544MenuItem.DropDown.LocationChanged -= DropDownLocationChanged; 2545MenuItem.DropDown.Click -= DropDownClick;